how to swap two numbers with out using temp variable
Answer Posted / a.g.dhivyalakshmi
//swaping of 2 numbers without using temp variable
//a=5 & b=6
a=a+b; //a=30
b=a-b; //b=5
a=a-b; //a=6
//Thus two numbers are swapped
// or
//a=5 & b=6
a=a*b; //a=30
b=a/b; //b=5
a=a/b; //a=6
//Thus two numbers are swapped
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
Why do we need constructors in c++?
Can create new c++ operators?
Can c++ do everything c can?
What is function overloading c++?
What is #include cstdlib in c++?
What do you mean by global variables?
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
What is ofstream c++?
What do you understand by pure virtual function? Write about its use?
What is the meaning of c++?
Explain the concept of copy constructor?
What are exceptions c++?
How can a struct in c++ differs from a struct in c?
Explain the difference between overloading and overriding?
What parameter does the constructor to an ofstream object take?