Hi All,
I am new to programming and want to know how can i write a
code to take input of 2 numbers from user and swap it
without using a temp variable?

Answers were Sorted based on User's Feedback



Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers..

Answer / x

a=a+b;
b=a-b;
a=a-b;

Is This Answer Correct ?    3 Yes 1 No

Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers..

Answer / gopi

a=A+b;
b=a-b;
a=a-b;

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More OOPS Interview Questions

What is an interface in oop?

0 Answers  


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

0 Answers  


What is the use of fflush(stdin) in c++?

4 Answers   HCL,


What are the 3 principles of oop?

0 Answers  


What is the purpose of polymorphism?

0 Answers  


What are constructors in oop?

0 Answers  


How to overload postfix operator in c++

1 Answers   Mphasis,


what is a class

6 Answers  


Do you know about multiple inheritance?

1 Answers   Motorola,


What is polymorphism and its types?

0 Answers  


how can we design a magic square in c++?or suggest me the basic idea of it.

3 Answers  


Why static Function is used in C++?

4 Answers   TCS,


Categories