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

Why was c++ made?

1086


What do you mean by public protected and private in c++?

1056


find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

2540


. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?

3274


What is an operator function? Describe the function of an operator function?

1146


What is the purpose of template?

1109


True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends

2377


What are the rules about using an underscore in a c++ identifier?

1179


What are friend classes?

1064


What are the advantages of pointers?

1061


What is #include iostream?

1244


What do you mean by inheritance in c++? Explain its types.

1135


Can c++ do everything c can?

1085


What is c++ programming language?

1098


What is operators in c++?

1005