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
What is the default access level?
What is abstract class in c++?
What do you mean by storage classes?
Is swift faster than c++?
Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?
Who created c++?
What is a container class? What are the types of container classes in c++?
What is the use of cmath in c++?
Why do we need runtime polymorphism in c++?
What is a local variable?
Can we delete this pointer in c++?
What is the use of endl in c++?
What are c++ manipulators?
How do you declare A pointer to function which receives an int pointer and returns a float pointer
What is data abstraction? How is it different from data encapsulation?