how to swap the variables without using temp and operators



how to swap the variables without using temp and operators..

Answer / santhosh

int a, b;
a = 10;
b = 20;
a = a + b;
//a=30
b = a - b;
a = a - b;

Console.WriteLine("a={0},b={1}", a, b);
Console.ReadLine();

Is This Answer Correct ?    10 Yes 2 No

Post New Answer

More OOPS Interview Questions

What causes polymorphism?

0 Answers  


What is the difference between class and structure?

7 Answers  


what is diff between .net 1.1 and .net 2.0

4 Answers  


write a c++ program to find maximum of two numbers using inline functions.

3 Answers   IBM,


State what is encapsulation and friend function?

0 Answers   BirlaSoft,


write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.

4 Answers  


What is multilevel inheritance in oop?

0 Answers  


what is different between oops and c++

0 Answers   IIT,


what is the need of abstraction? what is abstraction?what is the abstraction for stack?

8 Answers   CTS, Verizon,


What are the 4 pillars of oop?

0 Answers  


What is encapsulation?

17 Answers   TCS,


advantage and disadvantage in c++>>oops and what are the questions ask for interview in c++>>oops. could you tell me or reply me

0 Answers  


Categories