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 character constants?

1179


what is the height of tree if leaf node is at level 3. please explain

2149


What are shell structures used for?

1048


What are reserved words with a programming language?

1135


What is the use of printf() and scanf() functions?

1128


What are the advantages and disadvantages of c language?

1013


what will be maximum number of comparisons when number of elements are given?

1902


what is a constant pointer in C

1158


Explain can static variables be declared in a header file?

1150


Which of these functions is safer to use : fgets(), gets()? Why?

1095


When should the const modifier be used?

1105


Can the curly brackets { } be used to enclose a single line of code?

1169


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

1069


What is the best style for code layout in c?

1098


What is malloc calloc and realloc in c?

1321