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
How to compare array with pointer in c?
What are keywords in c with examples?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
What is the hardest programming language?
Tell me what is null pointer in c?
What is #include called?
What is page thrashing?
Is it better to bitshift a value than to multiply by 2?
Explain what are the __date__ and __time__ preprocessor commands?
When do we get logical errors?
How do you determine a file’s attributes?
Are there any problems with performing mathematical operations on different variable types?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is the heap?
What is the best style for code layout in c?