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 proxy objects in c++?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
Can you please explain the difference between overloading and overriding?
How the keyword struct is different from the keyword class in c++?
What is the use of cmath in c++?
What is encapsulation in C++? Give an example.
What is input operator in c++?
You run a shell on unix system. How would you tell which shell are you running?
What is using namespace std in cpp?
How to implement is-a and has-a class relationships?
What is function prototyping?
What is a node class in c++?
Explain what are the sizes and ranges of the basic c++ data types?
Do you know about C++ 11 standard?
What is a .h file c++?