Swapping two value


#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,temp;
clrscr();
printf("enter the value of x,y:-");
scanf("%d%d",&x,&y);
printf("before swop n=%d",x,y);
temp=x;
x=y;
y=temp;
printf("after swop x=%d\n,y=%d",x,y);
getch();
}
 Output:-
enter the value of x,y:-3,5
before swop x=3,y=5
after swop x=5,y=3





Previous                                   Next

No comments:

Post a Comment