/* Swapping two numbers (using three variables) - SWAPTHRE.C */
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the first no. ");
scanf("%d",&a);
printf("Enter the second no. ");
scanf("%d",&b);
printf("/n Before Swapping: \n\n");
printf("a= %d \t b= %d",a,b);
c=a;
a=b;
b=c;
printf("\n After Swapping: \n\n");
printf("a= %d \t b= %d",a,b);
getch();
}
No comments:
Post a Comment