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 two numbers with out using temp variable

Answer Posted / vishal gupta

well, use math:

x=5;
y=7;
x = x * y;
y = x / y;
x = x / y;

And the numbers have been swapped without the use of an
extra variable. I hope it helped.

Is This Answer Correct ?    44 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are structures and unions?

1011


Can union be self referenced?

1167


How is modularity introduced in C++?

1220


What is a vector c++?

1190


Explain the uses of static class data?

1114


What is the benefit of learning c++?

1003


What happens when the extern "c" char func (char*,waste) executes?

1089


Can java be faster than c++?

1164


How would perform Pattern Matching in C++?

1244


What do you mean by stack unwinding in c++?

1246


Is c++ used anymore?

1103


What is the difference between cin.read() and cin.getline()?

1086


Why we use #include iostream in c++?

1064


What is split a string in c++?

1198


What are the various storage classes in C++?

1144