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

WAP find square root of any number (without using sqrt() )?

3 Answers  


What are objects in oop?

0 Answers  


What is inheritance in simple words?

0 Answers  


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?

2 Answers  


what is mean by design pattern

4 Answers  


define oops concept with example

1 Answers   Cap Gemini,


How does polymorphism work?

0 Answers  


How do you explain polymorphism?

0 Answers  


What is this interview room ? Is it a class or an object.

3 Answers   CybAge, NSN, Wipro,


What is encapsulation in oops?

0 Answers  


What are the 5 oop principles?

0 Answers  


Categories