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
Why was c++ made?
What do you mean by public protected and private in c++?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
What is an operator function? Describe the function of an operator function?
What is the purpose of template?
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
What are the rules about using an underscore in a c++ identifier?
What are friend classes?
What are the advantages of pointers?
What is #include iostream?
What do you mean by inheritance in c++? Explain its types.
Can c++ do everything c can?
What is c++ programming language?
What is operators in c++?