Showing posts with label program to swap two numbers. Show all posts
Showing posts with label program to swap two numbers. Show all posts

Wednesday, July 20, 2011

Program to swap two numbers

/*Serial No.20     [swami99.cpp]*/

/* using third variable*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the first no. a=");
scanf("%d",&a);
printf("Enter the second no. b=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("\nAfter swap a=%d\tb=%d",a,b);
getch();
}