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 3 numbers without using 4th variable?

Answer Posted / ilana

The target is a<-b b<-c c<- a
------------------------------------
a = a+b+c ; // a+b+c b c
c = c+b; // a+b+c b b+c
b = c-b; // a+b+c c b+c
c = a-c; // a+b+c c a
a = a-(b+c) // b c a

Is This Answer Correct ?    12 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is main () in c?

1081


What is getche() function?

1053


What is scope of variable in c?

1048


What is the purpose of 'register' keyword in c language?

1033


How do I get an accurate error status return from system on ms-dos?

1135


What does %p mean?

1097


Write a program to reverse a given number in c language?

1127


Where are c variables stored in memory?

1083


Explain how can I make sure that my program is the only one accessing a file?

1230


Can we add pointers together?

1068


How can I open files mentioned on the command line, and parse option flags?

1075


Is a pointer a kind of array?

1194


Explain the difference between getch() and getche() in c?

1004


What is the use of function overloading in C?

1182


What is optimization in c?

1033