how to swap two integers 1 and 32767 without using third
variable
Answer Posted / mani654mani
Int var1=1, var2=32767;
var1 = var1 + var2;
var1 = 1 + 32767 =32768;
var2 = var1 - var2;
var2 = 32768 - 32767 = 1;
var1 = var1 - var2;
var1 = 32768 - 1 = 32767;
So Now var1 = 32767 and var2 = 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
What are file streams?
How do I use strcmp?
Difference between exit() and _exit() function?
How does struct work in c?
Is c call by value?
What is #include stdio h and #include conio h?
what is the diffrenet bettwen HTTP and internet protocol
c language interview questions & answer
Explain how many levels deep can include files be nested?
How can you increase the size of a statically allocated array?
Can you please compare array with pointer?
What are shell structures used for?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is the g value paradox?