how to swap two numbers with out using temp variable
Answer Posted / vishal gupta
well, use math:
x=5;
y=7;
x = x * y;
y = x / y;
x = x / y;
And the numbers have been swapped without the use of an
extra variable. I hope it helped.
| Is This Answer Correct ? | 44 Yes | 8 No |
Post New Answer View All Answers
What are structures and unions?
Can union be self referenced?
How is modularity introduced in C++?
What is a vector c++?
Explain the uses of static class data?
What is the benefit of learning c++?
What happens when the extern "c" char func (char*,waste) executes?
Can java be faster than c++?
How would perform Pattern Matching in C++?
What do you mean by stack unwinding in c++?
Is c++ used anymore?
What is the difference between cin.read() and cin.getline()?
Why we use #include iostream in c++?
What is split a string in c++?
What are the various storage classes in C++?