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 / mansi_engg

use unsigned before variable a and b in
a=1;
b=32767;
a=a+b;
b=a-b;
a=a-b;
bcoj 32767+1 =32768 which goes out of range of integer and
will be stored as -32768 which wil make the swapping
wrong.by using unsigned, addition will come in range 0-65536
and thus the process works.

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does int main () mean?

1029


What do you mean by keywords in c?

1153


What is a newline escape sequence?

1106


Is main is a keyword in c?

1129


Is c is a low level language?

1143


Explain what is wrong in this statement?

1125


What is the use of header files?

1114


What is the difference between union and structure in c?

1180


Can include files be nested?

1113


What is the translation phases used in c language?

1124


please explain every phase in the "SDLC" in the dotnet.

2621


What is the auto keyword good for?

1158


Differentiate between #include<...> and #include '...'

1062


about c language

2016


Write a program to know whether the input number is an armstrong number.

1125