#include <stdio.h>
int main ( int argc, char* argv [ ] )
{
int value1 = 10;
int value2 = 5;
printf ( "\n The sum is :%d", value1 | value2 );
}
This is the answer asked by some one to add two numbers
with out using arithmetic operator?Yes this answer is write
it given out put as 15.But how?????
what is need of following line?
int main ( int argc, char* argv [ ] )
how it work?what is the meaning for this line?
please explain me.Advance thanks
Answer Posted / deepak
binary value of 10 = 1010
binary value of 5 = 0101
so if u do bitwise OR. u will get 1111, which is the binary
value of 15. Note: This will not work for all the case:
For eg, value1 = 5 and value2 = 5 will not give u 10.
Instead the printf will print 5 only.
| Is This Answer Correct ? | 16 Yes | 1 No |
Post New Answer View All Answers
why wipro wase
What is header file in c?
Is register a keyword in c?
Tell us something about keyword 'auto'.
In a switch statement, what will happen if a break statement is omitted?
Explain how can I prevent another program from modifying part of a file that I am modifying?
How can you pass an array to a function by value?
Are pointers really faster than arrays?
write a c program for swapping two strings using pointer
What is || operator and how does it function in a program?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Explain About fork()?
What are identifiers in c?
The file stdio.h, what does it contain?
write a program fibonacci series and palindrome program in c