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 number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number

1209


What are arrays c++?

1052


What is this weird colon-member (" : ") syntax in the constructor?

966


What do you mean by ‘void’ return type?

1003


What is copy constructor? Can we make copy constructor private in c++?

1031


What is the need of a destructor?

1072


Explain the difference between c & c++?

1023


Eplain extern keyword?

979


Which bitwise operator is used to check whether a particular bit is on or off?

1013


What is the type of 'this' pointer?

976


What is the best free c++ compiler for windows?

1047


What is abstraction in c++?

1275


What are the classes in c++?

1055


Explain the difference between new() and malloc() in c++?

1071


What c++ library is string in?

1004