write a program to swap Two numbers without using temp variable.
Answer Posted / yash paranjape
a=a^b;
b=a^b;
a=a^b;
i.e
a^=b;
b^=a;
a^=b;
more simplifie i.e in just one line
a^=b^=a^=b;
This also works fine
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
in linking some of os executables are linking name some of them
What is void main () in c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
How is a macro different from a function?
Difference between constant pointer and pointer to a constant.
What are the different types of endless loops?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
What is operator promotion?
Can the curly brackets { } be used to enclose a single line of code?
What is the use of printf() and scanf() functions?
what are bit fields in c?
Write a code to generate divisors of an integer?
What is the difference between c &c++?
What are directives in c?
Explain what are global variables and explain how do you declare them?