How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance

Answer Posted / srikanth

int x,y;

x =x-y;
y =y+x;
x =y-x;

or

int x,y;

x=x^y;
y=x^y;
x=x^y;

or

int x,y;
x*=xy;
y=x/y;
x=x/y;

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

653


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)

5806


What is the difference between Printf(..) and sprint(...) ?

792


When should a type cast be used?

577


Can you tell me how to check whether a linked list is circular?

775






Which header file should you include if you are to develop a function which can accept variable number of arguments?

814


What is logical error?

605


When should you use a type cast?

595


What does nil mean in c?

676


What is a memory leak? How to avoid it?

580


What is call by value in c?

562


Describe wild pointers in c?

644


What do mean by network ?

661


Is a pointer a kind of array?

602


Write a program to print "hello world" without using a semicolon?

600