#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter two numbers");
scanf("%d%d",&a,&b);
printf("\nBefore Swap");
printf("\na=%d b=%d",a,b);
a=a+b;
b=b-a;
a=b-a;
printf("\nAfter Swap");
printf("\na=%d b=%d",a,b);
getch();
}
Output
Enter two numbers 3
5
Before Swap
a=3 b=5
After Swap
a=5 b=3
No comments:
Post a Comment