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

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

example int a=2;int b=3
put a=2 & b=3
a=2+3;
b=5-3;
a=5-2;
a=3;
b=2;

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

1136


Disadvantages of C language.

1067


In a byte, what is the maximum decimal number that you can accommodate?

1096


What is a null pointer in c?

1168


Why is a semicolon (;) put at the end of every program statement?

1051


Explain a pre-processor and its advantages.

1098


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

1078


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

1088


How to delete a node from linked list w/o using collectons?

2746


What is #define used for in c?

1036


Is it acceptable to declare/define a variable in a c header?

1080


Why is it important to memset a variable, immediately after allocating memory to it ?

2031


What is a wrapper function in c?

1092


How do I send escape sequences to control a terminal or other device?

1038


What does node * mean?

1166