Feb 24, 2007

C++ Program to swap two numbers

C++ program to swap to numbers (integers) means this program will accept two numbers and it interchange their values.
#include<iostream.h>
#include<conio.h>
main()
{
int a,b,c;
clrscr();
a=20;
b=50;
cout<<a;
cout<<endl<<b;
c=a;
a=b;
b=c;
cout<<endl<<"Now a is : = "<<a;
cout<<endl<<"And Now b is : = "<<b;
getch();
}

No comments:

Post a Comment