Swap two values using Third variable
========================================================================
#include<iostream>
using namespace std;
main()
{
int Number1,Number2,temp;
cout<<"Enter Number1 & Number2\n";
cin>>Number1>>Number2;
cout<<"Entered Numbers Before Swaping\n";
cout<<Number1<<" "<<Number2<<endl;
temp=Number1;
Number1=Number2;
Number2=temp;
cout<<"Entered Numbers After Swaping \n";
cout<<Number1<<" "<<Number2<<endl;
}
OutPut:
========================================================================
0 comments:
Post a Comment