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

Is it possible to run a c program without using main?If yes HOW??

13 Answers   Wipro,


Program to display given 3 integers in ascending order

1 Answers   N Tech,


main() { int i; printf("%d",i^i); }

1 Answers  


What are advantages and disadvantages of recursive calling ?

12 Answers   College School Exams Tests, Evolving Systems, HP, Jyoti Ltd, Sage, Wipro,


What are keywords in c with examples?

1 Answers  


Write a C program to print 1 2 3 ... 100 without using loops?

15 Answers   Hindalco,


What are the application of c?

1 Answers  


Write a program to print “hello world” without using semicolon?

1 Answers  


What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

21 Answers   ADITI, Student, TCS,


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

1 Answers  


What is sorting in c plus plus?

1 Answers  


Are the variables argc and argv are local to main?

1 Answers   TISL,


Categories