c++ program to swap two numbers

#include <iostream>                     
using namespace std;                                Download C++ Swap
int main() {


int a,b,temp;
cout<<"Enter 1st Number : ";
cin>>a;
cout<<"Enter 2nd Number : ";
cin>>b;
 // swapping start 
temp=a;
a=b;
b=temp;
// swapping end

cout<<"New Value of a is "<<a<<endl;
cout<<"New Value of b is "<<b<<endl;
 system("pause");
return 0;
}

No comments:

Post a Comment