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
how do you programme Carrier Sense Multiple Access
Does c have an equivalent to pascals with statement?
What are comments and how do you insert it in a C program?
What are external variables in c?
How can you tell whether a program was compiled using c versus c++?
How do I use void main?
What is derived datatype in c?
What are the different types of pointers used in c language?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
difference between native and cross compilers
What is a buffer in c?
Explain what is the benefit of using #define to declare a constant?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What is a memory leak? How to avoid it?