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

How does sizeof know array size?

642


Explain how can I open a file so that other programs can update it at the same time?

609


How many bytes are occupied by near, far and huge pointers (dos)?

684


Should I learn data structures in c or python?

594


can anyone please tell about the nested interrupts?

1687






How to write a multi-statement macro?

633


What is this infamous null pointer, anyway?

625


What is void main ()?

625


Explain how does flowchart help in writing a program?

644


what is the basis for selection of arrays or pointers as data structure in a program

3797


What do you know about the use of bit field?

620


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1553


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1872


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

1905


What is the default value of local and global variables in c?

567