ProAnswers.org

Write a program to interchange 2 variables without using the third one.

int a=20,b=30;

a=a+b;//50

b=a-b;//50-30=20

a=a-b;//50-20=30

#include

#include



void main()



{



int a,b;



clrscr();



printf(“enter the two values

”);

scanf(“%d%d”,&a,&b);



a=a+b;



b=a-b;



a=a-b;



printf(“a=%d

b=%d
”,a,b);

getch();



}



[b]Output: [/b]



enter the two values:



9



8



a=8



b=9