swap two numbers without using third variable

#include<stdio.h>
#include<conio.h>
int main()
{
	int a,b;
	printf("\nenter the value of a = ");
	scanf("%d",&a);
	printf("\nenter the value of b = ");
	scanf("%d",&b);
	a=a+b;
	b=a-b;
	a=a-b;
	printf("\nafter swaping the values");
	printf("\nvalue of a = %d",a);
	printf("\nvlaue of b = %d",b);
	return 0;
}

Leave a comment