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

why overriding?

3 Answers  


WHEN A COPY CONSTER IS CALL ?

4 Answers  


i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

3 Answers   Infosys,


WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP

2 Answers  


what are abstract classes and how they impliment , with example

2 Answers  






design class for linked list and include constructor,destructor,insert option. node of form struct node { int data; struct node &ptr; }

0 Answers  


what is a binary overloading

2 Answers  


What are constructors in oop?

0 Answers  


how do you handle yourself when you feel the wald is aganist you

2 Answers  


What do you mean by inline function?

6 Answers  


What is super in oop?

0 Answers  


What is coupling in oop?

0 Answers  


Categories