#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 is sizeof () an operator and not a function?
Explain what is output redirection?
What is difference between structure and union in c programming?
Why is event driven programming or procedural programming, better within specific scenario?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
Write a program of prime number using recursion.
What are the salient features of c languages?
Explain how can I avoid the abort, retry, fail messages?
What are conditional operators in C?
how can use subset in c program and give more example
How do we open a binary file in Read/Write mode in C?
What is a floating point in c?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Why can’t we compare structures?