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 proxy objects in c++?

1233


Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.

6455


Can you please explain the difference between overloading and overriding?

1148


How the keyword struct is different from the keyword class in c++?

1086


What is the use of cmath in c++?

1120


What is encapsulation in C++? Give an example.

1152


What is input operator in c++?

1082


You run a shell on unix system. How would you tell which shell are you running?

1216


What is using namespace std in cpp?

1246


How to implement is-a and has-a class relationships?

1082


What is function prototyping?

1169


What is a node class in c++?

1114


Explain what are the sizes and ranges of the basic c++ data types?

1201


Do you know about C++ 11 standard?

1143


What is a .h file c++?

1097