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 are the ways to a null pointer can use in c programming language?
Explain what are header files and explain what are its uses in c programming?
What is strcpy() function?
Why is structure padding done in c?
What are identifiers and keywords in c?
What is the newline escape sequence?
What are qualifiers in c?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What is scope of variable in c?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Why do we use static in c?
Explain the array representation of a binary tree in C.
Is flag a keyword in c?
What is New modifiers?
What are the types of c language?