#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
What are the usage of pointer in c?
What is time null in c?
What does 3 mean in texting?
Whats s or c mean?
What is the significance of scope resolution operator?
What are all different types of pointers in c?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
Is a house a mass structure?
What is pointer to pointer in c?
Is null a keyword in c?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is call by reference in functions?
Explain what is a const pointer?
Is boolean a datatype in c?
Why c is procedure oriented?