how to add two numbers without using arithmetic operators?
Answer Posted / sanjay bhosale
int x=12382,y=2;
int xor, and, temp;
and = x & y;
xor = x ^ y;
while(and != 0 )
{
and <<= 1;
temp = xor ^ and;
and &= xor;
xor = temp;
}
printf(" sum is : %d",xor);
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is data structure in c language?
Why ca not I do something like this?
What is a wrapper function in c?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Why c language?
What is the difference between variable declaration and variable definition in c?
What is structure padding in c?
What are actual arguments?
Explain what is the use of a semicolon (;) at the end of every program statement?
What is the purpose of main( ) in c language?
How many loops are there in c?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
Why do we use pointer to pointer in c?
Is it better to use a macro or a function?
What is file in c preprocessor?