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
How does sizeof know array size?
Explain how can I open a file so that other programs can update it at the same time?
How many bytes are occupied by near, far and huge pointers (dos)?
Should I learn data structures in c or python?
can anyone please tell about the nested interrupts?
How to write a multi-statement macro?
What is this infamous null pointer, anyway?
What is void main ()?
Explain how does flowchart help in writing a program?
what is the basis for selection of arrays or pointers as data structure in a program
What do you know about the use of bit field?
#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??
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What is the default value of local and global variables in c?