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

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

6785


What are file streams?

988


How do I use strcmp?

1041


Difference between exit() and _exit() function?

1097


How does struct work in c?

1042


Is c call by value?

985


What is #include stdio h and #include conio h?

1068


what is the diffrenet bettwen HTTP and internet protocol

1804


c language interview questions & answer

1925


Explain how many levels deep can include files be nested?

1041


How can you increase the size of a statically allocated array?

1055


Can you please compare array with pointer?

1050


What are shell structures used for?

1001


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2295


What is the g value paradox?

1128