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
Is there a sort function in c++?
What is virtual destructor? What is its use?
Why do we need constructors in c++?
What are the steps in the development cycle?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
What is static class data?
What's the most powerful programming language?
Explain queue. How it can be implemented?
What is math h in c++?
what is pre-processor in C++?
How to implement is-a and has-a class relationships?
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
Can you pass an array to a function in c++?
List the merits and demerits of declaring a nested class in C++?
When one must use recursion function? Mention what happens when recursion functions are declared inline?