C Program To Swap Two Numbers using Third Variable
#include<stdio.h>
int main()
{
//take two numbers a and b for swapping
int a, b;
int temp;
printf("Enter value of a: ");
scanf("%d", &a);
printf("Enter the value of b: ");
scanf("%d", &b);
// now swap two variable a and b
temp=a;
a=b;
b=temp;
printf("After swap a = %d amd b = %d", a , b);
return 0;
}
Description:
1. To swap two numbers we will use any third variable to store extra value so that we can change value of a and b.
