how to swap two numbers with out using temp variable

Answer Posted / raja

if a=10& b=20

a=a+b //a=30
b=a-b //b=10
a=a-b //a=20

finally we got a=20,b=10

Is This Answer Correct ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between list x; & list x();.

598


What are the various arithmetic operators in c++?

569


What are the various situations where a copy constructor is invoked?

602


What is the full form of stl in c++?

670


What is meant by the term name mangling in c++?

514






Can there be at least some solution to determine the number of arguments passed to a variable argument list function?

597


Explain virtual destructor?

668


Can we inherit constructor in c++?

582


What is pair in c++?

623


What is ostream in c++?

567


Is atoi safe?

589


Can a function take variable length arguments, if yes, how?

565


What is a multimap c++?

667


What are manipulators used for?

601


What are built-in functions? What is the syntax for the definition?

564