/*WAP to swap values of 2 variables without using 3rd variable */ #include<stdio.h> void main() { int a,b; clrscr(); printf("Enter The Value for A & B\n"); scanf("%d%d",&a,&b); printf("Values Before Swapping A & B \n"); printf("A=%d \t B=%d \n",a,b); a=a+b; b=a-b; a=a-b; printf("Values After Swapping\n "); printf("A=%d \t B=%d",a,b); getch(); }

The numbers can then be swapped using the sum and subtraction from the sum.

**Output:**

Enter The Value for A & B 123 456 Values Before Swapping A & B A=123 B=456 Values After Swapping A=456 B=123