Friday, April 16, 2010

Swaping of numbers

#include<iostream.h>
#include<conio.h>
 void main()
 {
 int a,b,c;
 clrscr();
 cout<<"Enter 1st no.\n";
 cin>>a;
 cout<<"Enter 2nd no.\n";
 cin>>b;
 cout<<"Before swapping\n";
 cout<<"a=\n"<<a;
 cout<<"b=\n"<<b;
 cout<<"After swapping\n";
 a=b;
 b=c;
 c=a;
 cout<<"a="<<a;
 cout<<"b="<<b;
 getch();
 }

No comments:

Post a Comment