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

Can a constructor be private?

1044


List different attributes in C++?

1039


Which field is used in c++?

1070


Which programming language is best to learn first?

1028


What is the difference between #import and #include in c++?

1075


Explain the difference between using macro and inline functions?

1079


What parameter does the constructor to an ofstream object take?

1027


Do you know about latest advancements in C++ ?

1193


Which bit wise operator is suitable for putting on a particular bit in a number?

1168


What are the rules for naming an identifier?

1034


Which programming language's unsatisfactory performance led to the discovery of c++?

1288


What are the general quetions are in DEna bank manager IT/System interviews?

1984


What is virtual destructor ans explain its use?

1097


Is c++ built on c?

987


Write a program to add three numbers in C++ utilizing classes.

1076