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...

write a program to swap Two numbers without using temp variable.

Answer Posted / swechha

a=a-b
b=a+b
a=b-a

if a=5 and b=10 then
a=5-10=(-5)
b=(-5)+10=5
a=5-(-5)=5+5=10

now a=10 & b=5

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How reliable are floating-point comparisons?

1040


What is the mean of function?

1066


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2524


Can we access array using pointer in c language?

1044


What is the difference between array and pointer in c?

1092


Is it possible to execute code even after the program exits the main() function?

1283


What is spaghetti programming?

1074


What is LINKED LIST? How can you access the last element in a linked list?

1021


What are types of structure?

1068


What is pointer & why it is used?

1063


What is the method to save data in stack data structure type?

1037


Why do we need a structure?

984


What are the advantages of using linked list for tree construction?

1027


What is property type c?

1047


main() { printf("hello"); fork(); }

1149