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 integers 1 and 32767 without using third
variable

Answer Posted / mani654mani

Int var1=1, var2=32767;
var1 = var1 + var2;
var1 = 1 + 32767 =32768;

var2 = var1 - var2;
var2 = 32768 - 32767 = 1;

var1 = var1 - var2;
var1 = 32768 - 1 = 32767;

So Now var1 = 32767 and var2 = 1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is spark map function?

1060


How can this be legal c?

1045


How can I get random integers in a certain range?

1019


When is the “void” keyword used in a function?

1430


Difference between strcpy() and memcpy() function?

1075


What are identifiers and keywords in c?

1037


What are lookup tables in c?

953


how to construct a simulator keeping the logical boolean gates in c

2203


What is cohesion in c?

925


Explain what is the heap?

1016


How important is structure in life?

1030


What does %d do in c?

913


Is there a built-in function in C that can be used for sorting data?

1184


Explain how does flowchart help in writing a program?

1064


Do character constants represent numerical values?

1288