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 / vignesh1988i
this will work correctly.....vignesh1988i
#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 ? | 7 Yes | 7 No |
Post New Answer View All Answers
Differentiate between functions getch() and getche().
What are the types of pointers in c?
what do the 'c' and 'v' in argc and argv stand for?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is character constants?
What is the purpose of main( ) in c language?
What is memory leak in c?
Hi can anyone tell what is a start up code?
What is an expression?
State the difference between realloc and free.
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is main return c?
Explain about the constants which help in debugging?
What is s in c?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions