The program will accept two numbers form the user “a” and “b” for swapping. For this purpose, we have to use a third variable “tmp”.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,tmp;
clrscr();
printf(“enter number”);
scanf(“%d”,&a);
printf(“enter any number”);
scanf(“%d”,&b);
tmp=a;
a=b;
b=tmp;
printf(“After swapping”);
printf(“\n”);
printf(“%d\n”,a);
printf(“%d”,b);
getch();
}
Output: