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 values between two variables without using a
third variable?

Answer Posted / nisay mizrahi

double a,b;
System.out.println("put in 2 numbers");
a=in.nextDouble();
b=in.nextDouble();
if(a>b){
a=a-b;
b=b+a;
a=b-a;

}
else
if(b>a){
b=b-a;
a=a+b;
b=a-b;
}
System.out.println("a is "+a);
System.out.println("b is "+b);
}

}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hai i am prasanna.I am MCA 2009 fresher.tell me about certifications.which certification helps me to improve my carrier and to get a technically oriented job ,which certification helps to get job faster.

2366


Write a shell program where you enter a number which corresponds to K.M. Find out the corresponding values in m, cm, inches, and feet. Hints:- 1 k.m= 1000 m 1 m= 100 cm 1 inches= 2.54 cm. 1 feet= 12 inches

1920


What is %Type,%Rowtype?

2225


1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?

2330


What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe

1929


Where do we need Operator overloading?

1071


Write a program to swap the content of two variables without using a third variable.

1020


smal talk is pure object oriented or not?

1907


Compare any 4 software development life cycle paradigms with each other. Indicate at least one application for each of the paradigms that are suitable to developed using that paradigm.

2780


how much fee for deccan soft institute .how to block seat for sandeep sir class reply soonnnn 

2183


What is test execution and when will we start execution please send me one example for this question

1813


can any one suggestion me present which course(except java,.net) has huge demand in the market?

2016


EXPLAIN UNARY OPEARATORS

2194


How to know we are in home page of a web application using QTP

2386


what is the use MDM(Master Data Management)and meaning

2363