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
Answers were Sorted based on User's Feedback
Answer / rajesh bhansali
#include<stdio.h>
main()
{
int x, y, z, a;
printf("Type values of x, y and z\n");
scanf("%d %d %d",&x,&y,&z);
printf("On rotation we found the following values
assigned to x,y,z.\n");
a=z;
z=x;
x=y;
y=a;
printf("x=%d, y=%d, z=%d", x,y,z);
getch();
}
Is This Answer Correct ? | 60 Yes | 12 No |
Answer / likhit gatagat
#include<stdio.h>
main()
{
int a,b,c,p,q,r;
printf("Enter three numbers:\n");
Scanf("%d%d%d",&a,&b,&c);
p=a;
q=b;
r=c;
b=p;
c=q;
a=r;
printf("%d%d%d",a,b,c);
}
Is This Answer Correct ? | 17 Yes | 8 No |
Answer / maddy :)
#include <stdio.h>
#include <conio.h>
void main()
{
int x=1,y=2,z=3,s=0;
s=x,x=y,y=z,z=s;
printf("The value of x=%d,y=%d,z=%d",x,y,z);
}
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / nitin
void main()
{
int a,b,c;
printf("enter the values of a,b &c");
scanf("%d%d%d",&a,&b,&c);
c=c+a;
a=c-a;
c=c+b;
b=c-b;
c=c-b;
printf("\n values of ab & c are=%d%d%d",a,b,c);
getch();
}
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / 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 |
Answer / vignesh1988i
SINCE THE SWAPPING OF THREE NUMBERS WILL HAVE 3! OF
COMBINATIONS.... I AM KEEPING THE LIMIT VALUE AS 6.
#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)
{
if(b>c)
p=b-c;
else
p=c-b;
b=p+b;
b=a+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 ? | 6 Yes | 8 No |
Answer / 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 |
regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression
what is answer for perfect number????????????????
Is main is user defined function?
Give a method to count the number of ones in a 32 bit number?
what is the syallabus of computer science students in group- 1?
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access?
What is meaning of "Void main" in C Language.
24 Answers Ford, GU, HCL, IBIBS, JUW, TCS,
If I have a char * variable pointing to the name of a function ..
write a function for strtok()??
Tell me what are bitwise shift operators?
What are the different types of linkage exist in c?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE