Wednesday, 23 November 2011

Program to Swap or Interchange Two Numbers

/*Program to swap or interchange two numbers.
                                    Compiler Used   : Turbo C++ 4.5
                                    OS Used             : Windows 7
*/            
#include<iostream.h>
#include<conio.h>
int main()
{
int a, b, temp;
clrscr();
cout<<"\nEnter A: ";
cin>>a;
cout<<"\nEnter B: ";
cin>>b;
temp=a;
a=b;
b=temp;
cout<<"\n\nAfter Interchanging:";
cout<<"\nValue of A: "<<a;
cout<<"\nValue of B: "<<b;
getch();
return 0;
}

No comments :

Post a Comment