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 / 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


Please Help Members By Posting Answers For Below Questions

What is identifier in c?

1009


What is the basic structure of c?

1076


What is the size of a union variable?

1053


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

1063


What does %c do in c?

984


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

1125


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

1112


In c language can we compile a program without main() function?

1133


What does sizeof function do?

1190


Implement bit Array in C.

1138


how do you programme Carrier Sense Multiple Access

1967


if p is a string contained in a string?

1841


What is the code in while loop that returns the output of given code?

1982


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1118


what will be maximum number of comparisons when number of elements are given?

1902