#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


Please Help Members By Posting Answers For Below Questions

What is the function of volatile in c language?

670


What are disadvantages of C language.

652


What is variables in c?

611


What is d scanf?

597


What is a void pointer? When is a void pointer used?

629






Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

2244


What do you mean by c?

591


how to introdu5ce my self in serco

1525


What is a macro?

657


What is type qualifiers?

666


Explain how do you convert strings to numbers in c?

598


Is c object oriented?

544


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

661


What is time null in c?

587


How will you write a code for accessing the length of an array without assigning it to another variable?

618