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 fuction for accepting and replacing lowercase letter to'Z' with out using inline function.

5 Answers   Temenos,


wht is the difference between KPO and BPO ?

2 Answers   Accenture, BPO, HCK, HCL, Infosys,


How to run c Program without using IDE of c. means if program made in notepad.then how to compile by command prompt.

1 Answers   HP, TCS,


Write a program that accept anumber in words

0 Answers  


When should a far pointer be used?

0 Answers   Aspire, Infogain,






How can I change the size of the dynamically allocated array?

0 Answers  


Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We.....Are....Student “ Note: one .=1 Space Output: "We Are Student"

6 Answers   IBM,


Explain the concept and use of type void.

0 Answers  


What is define c?

0 Answers  


what is the differance between pass by reference and pass by value.

7 Answers   Infosys,


what will be the result of the following program ? char *gxxx() { static char xxx[1024]; return xxx; } main() { char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); } a) The string is : string b) The string is :Oldstring c) Run time error/Core dump d) Syntax error during compilation e) None of these

2 Answers   IBM,


20. main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); } Answer:??????

2 Answers  


Categories