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

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

if a=3 and b=5
then now b=a+b=8
and a=8-a=8-3=5,now a=5
b=8-a=8-5=3,now b=3

so, a=5 and b=3

Is This Answer Correct ?    198 Yes 59 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c is a middle level language?

1071


What is methods in c?

1104


Why is event driven programming or procedural programming, better within specific scenario?

2441


What are the advantages of union?

1071


Can you write the algorithm for Queue?

2127


What is the correct code to have following output in c using nested for loop?

1091


Explain how are 16- and 32-bit numbers stored?

1275


What is the use of extern in c?

1096


What is variables in c?

1055


What do you mean by dynamic memory allocation in c?

1105


What is the data segment that is followed by c?

1094


How to compare array with pointer in c?

1117


What is meant by type specifiers?

1140


What is New modifiers?

1135


What does %d do in c?

968