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 / a.g.dhivyalakshmi

//swaping of 2 numbers without using temp variable
//a=5 & b=6
a=a+b; //a=30
b=a-b; //b=5
a=a-b; //a=6

//Thus two numbers are swapped

// or
//a=5 & b=6
a=a*b; //a=30
b=a/b; //b=5
a=a/b; //a=6

//Thus two numbers are swapped

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need constructors in c++?

1060


Can create new c++ operators?

963


Can c++ do everything c can?

1003


What is function overloading c++?

1021


What is #include cstdlib in c++?

1139


What do you mean by global variables?

1026


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3593


What is ofstream c++?

1018


What do you understand by pure virtual function? Write about its use?

953


What is the meaning of c++?

967


Explain the concept of copy constructor?

986


What are exceptions c++?

991


How can a struct in c++ differs from a struct in c?

983


Explain the difference between overloading and overriding?

1082


What parameter does the constructor to an ofstream object take?

1004