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...

swapping program does not use third variable

Answer Posted / venkanna

swap(a,b);
{
a=a+b;
b=a-b;
a=a-b;
}
Explenation:
if a=5 and b=10
a=a+b(5+10)=15
b=a-b(15-10)=5------------swaped here
a=a-b(15-5)=10------------

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is encapsulation in oop?

1070


Can destructor be overloaded?

1044


Why oops is important?

1130


What is the purpose of polymorphism?

1136


What is an example of genetic polymorphism?

1195


What is oops and its features?

1095


What is object and example?

1184


What are the data types in oop?

1115


What is the oops and benefits of oops programming?

981


What is abstraction and encapsulation?

1029


How to use CMutex, CSemaphore in VC++ MFC

4791


What is for loop and its syntax?

1095


Why is polymorphism important in oop?

1093


Why interface is used?

1031


What is the fundamental idea of oop?

1144