Write a program that takes three variables(a,b,c) in as
separate parameters and rotates the values stored so that
value a goes to b,b,to c and c to a
Answer Posted / toto
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,p;
printf("enter the three values :");
scanf("%d%d%d",a,b,c);
printf("a=%d\nb=%d\nc=%d\n ",a,b,c);
for(int i=1;i<=6;i++)
{
if(i%2==1)
{
p=c;
c=b;
b=p;
printf("a=%d\nb=%d\nc=%d\n",a,b,c);
}
else
{
a=a+b;
if(a>b)
b=a-b;
else
b=b-a;
a=a-b;
printf("a=%d\nb=%d\nc=%d\n ",a,b,c);
}
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Explain the use of bit fieild.
how we can make 3d venturing graphics on outer interface
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Describe wild pointers in c?
How can I find the modification date and time of a file?
how to capitalise first letter of each word in a given string?
Do pointers store the address of value or the actual value of a variable?
Explain the difference between call by value and call by reference in c language?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
What is static memory allocation? Explain
What are the two types of functions in c?
When should you use a type cast?
What is dynamic dispatch in c++?
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?