/*C Program to swap two numbers without third variable*/
In C we have two techniques to swap the number
- Without using third variable
- Using third variable
1. Without using third variable swap the number:
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b;
printf("Enter First number in a = ");
scanf("%d",&a);
printf("Enter Second number in b = ");
scanf("%d",&b);
a= a+b;
b=a-b;
a=a-b;
printf("\nafter swaping the value of a = %d", a);
printf("\nafter swaping the value of b = %d", b);
getch();
}
Output: