how to swap 4 number without using temporary number?

Answers were Sorted based on User's Feedback



how to swap 4 number without using temporary number?..

Answer / brinda balakrishnan

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

Is This Answer Correct ?    25 Yes 0 No

how to swap 4 number without using temporary number?..

Answer / sandeep

a=a^b;
b=a^b;
a=a^b;

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

What is pointer to pointer in c with example?

0 Answers  


How can type-insensitive macros be created?

0 Answers  


What are the average number of comparisons required to sort 3 elements?

2 Answers   DRDO,


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

0 Answers  


void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?

7 Answers  






How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation.

1 Answers   HCL,


What is the mean of function?

0 Answers  


How can I list all of the predefined identifiers?

0 Answers  


what is the function of void main()?

8 Answers  


Explain what are multidimensional arrays?

0 Answers  


Write a program on swapping (100, 50)

0 Answers   BPL,


What is maximum size of array in c?

0 Answers  


Categories