#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
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
What is the purpose of clrscr () printf () and getch ()?
Write a program to print all permutations of a given string.
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Why n++ execute faster than n+1 ?
What is scope rule of function in c?
How old is c programming language?
pierrot's divisor program using c or c++ code
What is wrong with this program statement? void = 10;
What are the advantages of the functions?
How do you determine a file’s attributes?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Is c is a procedural language?
Explain the difference between #include "..." And #include <...> In c?
what will be maximum number of comparisons when number of elements are given?