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
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.
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
What is %Type,%Rowtype?
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?
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
Where do we need Operator overloading?
Write a program to swap the content of two variables without using a third variable.
smal talk is pure object oriented or not?
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.
how much fee for deccan soft institute .how to block seat for sandeep sir class reply soonnnnÂ
What is test execution and when will we start execution please send me one example for this question
can any one suggestion me present which course(except java,.net) has huge demand in the market?
EXPLAIN UNARY OPEARATORS
How to know we are in home page of a web application using QTP
what is the use MDM(Master Data Management)and meaning