Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is oops and its features?

1095


What is polymorphism what are the different types of polymorphism?

1020


What is the difference between a constructor and a destructor?

1275


What is the purpose of enum?

1019


Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

2470


What is protected in oop?

1090


Is oop better than procedural?

1045


Which is better struts or spring?

1066


Why we use classes in oop?

1053


when to use 'mutable' keyword and when to use 'const cast' in c++

2169


What polymorphism means?

1087


Can main method override?

1118


Why is static class not inherited?

1118


What is constructor overloading in oop?

1147


What is coupling in oops?

1163