Search This Blog

30 May, 2011

Swapping of two numbers using three variables - C program


/* 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

Meetme@