+ 1

using class swap two numbers without using third variable

22nd Jul 2016, 1:28 AM
Swati Singh
Swati Singh - avatar
2 Réponses
0
yes... w not....
22nd Jul 2016, 5:45 AM
meherDev
meherDev - avatar
0
#include<iostream> using namespace std; int main() { int a, b; cout<<"Enter n. to A and B"<<"\n"; cin>>a>>b; cout<<"\n"<<"Before Value"<<"\n"<<"A="<<a<<"\n"<<"B="<<b; a+=b; b=a-b; a-=b; cout<<"\n"<<"After Value"<<"\n"<<"A="<<a<<"\n"<<"B="<<b; return 0; }
22nd Jul 2016, 5:48 AM
meherDev
meherDev - avatar