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

Can c++ be faster than c?

1043


What is the average salary of a c++ programmer?

1029


Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement

1195


What is the exit function in c++?

997


Define the operators that can be used with a pointer.

1075


How to demonstrate the use of a variable?

1131


How important is c++?

993


What is the C-style character string?

1164


Is python better than c++?

1042


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1115


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

1281


What does it mean to declare a member function as static?

1076


What are disadvantages of pointers?

1047


List different attributes in C++?

1106


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

1034