// Swap values in three variables
# include<stdio.h>#include<conio.h>
void main()
{
int x,y,z,temp;
printf("Enter the value of x,y&z: ");
scanf("%d%d%d",&x,&y,&z);
temp=x; // swapping starts here
x=y;
y=z;
z=temp;
printf("Values after swapping:\n");
printf("x= %d\ny= %d\nz= %d",x,y,z);
getch();
}
Output
Swap three variables in c |
1 comment:
C program to swap values stored in variables.
Post a Comment