Swapping Of Two Numbers Without Using 3rd Variable In C


#include<stdio.h> #include<conio.h> void main(){ int a,b; clrscr(); printf("enter a value for a"); scanf("%d",&a); printf("enter a value for b"); scanf("%d",&b); a=a+b; b=a-c; a=a-b; printf("value for a is %d",a); printf("value for a is %d",b); getch(); }

Output:-

a=10
b=20
Swapping number is b=10
a=20