write a program to swap Two numbers without using temp variable.
Answer Posted / ramprasad
class Swap
{
static int iValue,jValue,tot;
public static int swap(int A, int B){
tot = A+B;
iValue = tot-B;
jValue = tot-iValue;
return iValue;
//return jValue;
}
public static void main(String[] args)
{
System.out.println(Swap.swap(5,6));
}
}
| Is This Answer Correct ? | 23 Yes | 8 No |
Post New Answer View All Answers
What is a method in c?
What are the uses of null pointers?
write a program to create a sparse matrix using dynamic memory allocation.
What is static volatile in c?
Why c is called procedure oriented language?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is difference between structure and union with example?
Differentiate abs() function from fabs() function.
What are the advantages and disadvantages of a heap?
What is maximum size of array in c?
What do you mean by keywords in c?
What is the difference between array and pointer?
Write a program to implement queue.
What is console in c language?
Do you have any idea about the use of "auto" keyword?