How to add two numbers without using arithmetic operators?

Answer Posted / selloorhari

Hi Nitish,

If we will do the LOGICAL OR function then we will get
either 1 or 0.
If we will do the BITWISE OR then we will get the largest of
the two..

For
ex:
Let us take, First number as 2 and Second number as 3..
Then as per the first case we will get 1 as the output.
10(2) || 11(3) -> 1(1)
As per the second case the output will be 3..
10(2) | 11(3) -> 11(3).
Ok

Is This Answer Correct ?    14 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I invoke another program or command and trap its output?

608


Explain that why C is procedural?

652


Explain how can I write functions that take a variable number of arguments?

606


State the difference between x3 and x[3].

648


Give basis knowledge of web designing ...

1569






Do you know the use of 'auto' keyword?

652


List out few of the applications that make use of Multilinked Structures?

1284


What is the difference between text and binary i/o?

586


What is the use of in c?

572


Explain the use of function toupper() with and example code?

651


What is the importance of c in your views?

586


Can you return null in c?

591


What is the use of void pointer and null pointer in c language?

623


Explain how can you restore a redirected standard stream?

587


Where is c used?

644