Write a C Program to Swap two numbers.
#include<stdio.h>
int main()
{
int a,b,temp;
printf(“Enter two numbers :\n”);
scanf(“%d %d”,&a,&b);
printf(“Before Swapping : a = %d, b = %d\n”,a,b);
temp=a;
a=b;
b=temp;
printf(“Before Swapping : a = %d, b = %d\n”,a,b);
return 0;
}
Output :
i) Enter two numbers :
10536 79
Before Swapping : a = 10536, b = 79
After Swapping : a = 79, b = 10536
Write a C Program to Swap two numbers without third variable.