#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 meant by keywords in c?

612


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1723


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2171


Are the variables argc and argv are always local to main?

569


What is the use of function overloading in C?

673






What is boolean in c?

603


Is c still used?

598


how is the examination pattern?

1595


What is the size of structure pointer in c?

610


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

3728


write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values.  The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.

2700


How can you restore a redirected standard stream?

606


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

2508


Explain how do you search data in a data file using random access method?

691


What is logical error?

603