#include<stdio.h>
void main()
{
int x,y;
clrscr();
printf("Enter two numbers\n");
scanf("%d %d",&x,&y);
printf("x=%d\n y=%d",x,y);
if(x>y)
{
(x=x-y);
(y=y+x);
(x=y-x);
}
else
{
(y=y-x);
(x=y+x);
(y=x-y);
}
printf("\n swapping success\nx=%d\n y=%d",x,y);
getch();
}
void main()
{
int x,y;
clrscr();
printf("Enter two numbers\n");
scanf("%d %d",&x,&y);
printf("x=%d\n y=%d",x,y);
if(x>y)
{
(x=x-y);
(y=y+x);
(x=y-x);
}
else
{
(y=y-x);
(x=y+x);
(y=x-y);
}
printf("\n swapping success\nx=%d\n y=%d",x,y);
getch();
}
No comments:
Post a Comment