#include<stdio.h>
#include<conio.h>
int x,y;
void exchange();
void main()
{
clrscr();
printf("\n Enter The Value Of X : ");
scanf("%d",&x);
printf("\n Enter The Value Of Y : ");
scanf("%d",&y);
exchange();
printf("\n After The exchange : ");
printf("\n Value Of X = %d \n Value Of Y = %d",x,y);
getch();
}
void exchange()
{
x=x+y; /* let x = 22 & y = 12 */
y=x-y; /* x=22+12=34 so, y=34-12=22 & x=34-22=12 */
x=x-y;
}
/*
******
OUTPUT
******
Enter The Value Of X : 45
Enter The Value Of Y : 22
After The exchange :
Value Of X = 22
Value Of Y = 45
*/