Showing posts with label Interchanging Program in C. Show all posts
Showing posts with label Interchanging Program in C. Show all posts

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;
}