how to swap 2 numbers in a single statement?

Answers were Sorted based on User's Feedback



how to swap 2 numbers in a single statement?..

Answer / ushagva1

a=a+b-(b=a);

Is This Answer Correct ?    21 Yes 2 No

how to swap 2 numbers in a single statement?..

Answer / uj

(x ^= y), (y ^= x), (x ^= y);

Is This Answer Correct ?    0 Yes 0 No

how to swap 2 numbers in a single statement?..

Answer / pedda

t=a;
a=b;
b=t;
t means temporary value

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More C Interview Questions

. Write a program to get a string and to convert the 1st letter of it to uppercase

2 Answers   HTC,


Explain what is wrong with this statement? Myname = ?robin?;

0 Answers  


Program to trim a given character from a string.

5 Answers   NetApp,


what is the hexidecimal number of 4100?

16 Answers   Google,


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

0 Answers  






What is information technology.

1 Answers  


what r the cpu registers r ther?

1 Answers  


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


What does typedef struct mean?

0 Answers  


what is available in C language but not in C++?

10 Answers   CTS, TCS,


difference between function & structure

9 Answers   Verizon,


What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?

2 Answers  


Categories