Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What does %c mean in c?

1106


What is difference between array and structure in c?

1205


How can a number be converted to a string?

1350


Is there a way to jump out of a function or functions?

1114


what is the significance of static storage class specifier?

2271


What are the types of bitwise operator?

1126


Tell us the use of fflush() function in c language?

1165


What is scope and lifetime of a variable in c?

1088


What is structure in c definition?

1064


What is the difference between abs() and fabs() functions?

1144


Was 2000 a leap year?

1062


Explain argument and its types.

1072


What is main function in c?

1092


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1166


What the different types of arrays in c?

1077