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
Can a constructor be private?
List different attributes in C++?
Which field is used in c++?
Which programming language is best to learn first?
What is the difference between #import and #include in c++?
Explain the difference between using macro and inline functions?
What parameter does the constructor to an ofstream object take?
Do you know about latest advancements in C++ ?
Which bit wise operator is suitable for putting on a particular bit in a number?
What are the rules for naming an identifier?
Which programming language's unsatisfactory performance led to the discovery of c++?
What are the general quetions are in DEna bank manager IT/System interviews?
What is virtual destructor ans explain its use?
Is c++ built on c?
Write a program to add three numbers in C++ utilizing classes.