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
Explain what is the benefit of using an enum rather than a #define constant?
What is the explanation for cyclic nature of data types in c?
Can you tell me how to check whether a linked list is circular?
What is the size of array float a(10)?
Explain the ternary tree?
What is the significance of an algorithm to C programming?
Does c have enums?
How a string is stored in c?
Why should I prototype a function?
Which node is more powerful and can handle local information processing or graphics processing?
What is the mean of function?
What is extern c used for?
Write a program to print factorial of given number using recursion?
Is null valid for pointers to functions?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?