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

can we make game by using c

1 Answers   SmartData,


What is difference between abstraction and encapsulation?

0 Answers  


explain the concepts of oops?

1 Answers  


What type of loop is a for loop?

0 Answers  


WHAT IS THE DIFFERENCE BETWEEN ABSTRUCTION AND ENCAPSULATION? PLEASE EXPLAIN IT.

7 Answers   ETH,






Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

0 Answers  


#include <iostream> using namespace std; int main() { int a = 2; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][c[1][4]]; }

2 Answers   TCS, Wipro,


different types of castings

3 Answers   Siemens,


A file pointer always contains the __________ of the file

5 Answers  


What is polymorphism and its types?

0 Answers  


What is new keyword in oops?

0 Answers  


What is difference between inheritance and polymorphism?

0 Answers  


Categories