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

Tell me can the size of an array be declared at runtime?

1002


What is a macro?

1073


What are runtime error?

1103


What is a const pointer in c?

1093


Sir i need notes for structure,functions,pointers in c language can you help me please

2369


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1228


What is an lvalue in c?

1096


How does sizeof know array size?

1092


Explain null pointer.

1073


What is merge sort in c?

1014


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2611


When should the volatile modifier be used?

1130


What functions are in conio h?

1168


Distinguish between actual and formal arguments.

1036


What is the basic structure of c?

1039