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 / guest

another way is using bitwise XOR (^).

a=9; //a=1001
b=5; //b=0101

a=a^b; //a=1100
b=a^b; //b=1001
a=b^a; //a=0101

Is This Answer Correct ?    29 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by funtion prototype?

1035


What is the arrow operator in c++?

973


What are the advantages of c++ over c?

1038


Can you please explain the difference between using macro and inline functions?

1020


What is c++ iterator?

1087


Explain selection sorting. Also write an example.

997


Describe the advantages of operator overloading?

1010


What is a class definition?

1039


Why is swift so fast?

1079


Who invented turbo c++?

1034


What is the purpose of ios::basefield in the following statement?

1222


What is the purpose of extern storage specifier?

1128


Which operator cannot be overloaded c++?

985


Can constructor be static in c++?

1077


What is a constructor in c++ with example?

1103