Given the value of the variables x,y and z. Write a program to rotate their
their values such that x has the value of y,y has the value of z and z has
the value of x.
#include<stdio.h>
void main()
{
int x,y,z,temp;
printf("Enter the value of z\n");
scanf("%d",&x);
printf("Enter the value of y\n");
scanf("%d",&y);
printf("Enter the value of z\n");
scanf("%d",&z);
temp=x,x=y,z=temp;
printf("X=%d\nY=%d\nZ=%d",x,y,z);
getch();
}
their values such that x has the value of y,y has the value of z and z has
the value of x.
#include<stdio.h>
void main()
{
int x,y,z,temp;
printf("Enter the value of z\n");
scanf("%d",&x);
printf("Enter the value of y\n");
scanf("%d",&y);
printf("Enter the value of z\n");
scanf("%d",&z);
temp=x,x=y,z=temp;
printf("X=%d\nY=%d\nZ=%d",x,y,z);
getch();
}
No comments:
Post a Comment