Swap two Numbers
#include<stdio.h>
void main()
{
int x,y,z;
printf("Enter Values x and y : ");
scanf("%d%d",&x,&y);
z=y;
y=x;
x=z;
printf("\nValue of x=%d",x);
printf("\nValue of y=%d",y);
}
#include<stdio.h>
void main()
{
int x,y,z;
printf("Enter Values x and y : ");
scanf("%d%d",&x,&y);
z=y;
y=x;
x=z;
printf("\nValue of x=%d",x);
printf("\nValue of y=%d",y);
}
Output
Enter Values x and y : 5 4
Value of x= 4
Value of y= 5
Comments
Post a Comment