C program to swap two numbers using temporary variable
PROGRAM:
#include<stdio.h>int main()
{
int a,b,temp;
printf("Enter values of a and b\n");
scanf("%d%d",&a,&b);
printf("Before swapping a=%d b=%d\n",a,b);
temp=a;
a=b;
b=temp;
printf("After swapping a=%d b=%d\n",a,b);
return 0;
}
OUTPUT:
Enter values of a and b10
20
Before swapping a=10 b=20
After swapping a=20 b=10