how to swap 2 numbers within a single statement?

Answers were Sorted based on User's Feedback



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

Answer / ushabharath

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

Is This Answer Correct ?    27 Yes 8 No

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

Answer / srinidhi

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

Is This Answer Correct ?    10 Yes 2 No

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

Answer / raja

a^=b^=a^=b;

Is This Answer Correct ?    6 Yes 1 No

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

Answer / ratishchandra huidrom

if(c=a&&a=b&&b=c)printf("%d %d",a,b);

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

Explain what is a program flowchart and explain how does it help in writing a program?

0 Answers  


from which concept of 'c', the static member function of 'c++' has came?

1 Answers   Bosch,


Write a code to remove duplicates in a string.

0 Answers   Expedia,


what are bit fields? What is the use of bit fields in a structure declaration?

0 Answers   Flextronics, TISL, Virtusa,


How do you write a program which produces its own source code as output?

0 Answers  






what is the syallabus of computer science students in group- 1?

0 Answers  


accept character from keyboard untill the user presses the enter key.If the user enters any character other than upper case(A-Z)alphabets program should stop taking any input

1 Answers  


What are the standard predefined macros?

0 Answers  


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

0 Answers  


what is the Output? int a=4 b=3; printf("%d%d%d%d%d%d",a++,++a,a++,a++,++a,a++); printf("%d%d%d%d%d%d",b--,b--,--b,b--,--b,--b);

10 Answers   IBM,


main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i]); } what will be the output? }

22 Answers   NDS, TCS,


What does extern mean in a function declaration?

4 Answers  


Categories