how to swap the variables without using temp and operators

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you answer polymorphism?

577


What are oops functions?

583


Why is abstraction used?

608


Why do we use polymorphism?

579


What is property in oops?

569






How to call a non virtual function in the derived class by using base class pointer

5268


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4242


What is interface? When and where is it used?

1664


What is the real time example of inheritance?

643


Can we override main method?

607


What are oops methods?

568


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

1652


What is polymorphism programming?

605


What is polymorphism in oops?

558


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2036