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
pleasew define carrier scope in abap (sap).
what is diff bet ref variable & instance of class
Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.
can we use commit,rollback in triggers and how?
What are two of your strengths that you will bring to our QA/testing team?
Suppose server object is not loaded into the memory, and the client request for it , what will happen?
Tips for blog integration by www.esteemwebsolutions.com. Can Any body suggest me to how to make wonderful questions on web integration..
we create a pf with 3 fields.2 is defined as keyfields.we lock it with alcobj command.how we find out whether the file is locked or not?is it dspfd??/
10.Define filters,binary to hexadecimal,hexadecimal to decimal?
Find out the list of authorization objects which contains activity as a field? Thanks in advance.
Which CRM is better to opt, Sebiel CRM or Salesforce CRM or sap CRM? which institute is best one in hyderabad
Colors specified with the notation
For a binary tree with n nodes, How many nodes are there which has got both a parent and a child?
where is available in this mantis toturials?
what is meant by life cycle of a business