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


Please Help Members By Posting Answers For Below Questions

What is self-referential structure in c programming?

661


What is void main () in c?

735


How do I get a null pointer in my programs?

621


What is the value of c?

575


What are register variables in c?

575






write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

1579


Is c easy to learn?

562


What are conditional operators in C?

628


Write a C program to count the number of email on text

1421


What are the types of c language?

560


What is class and object in c?

591


What is calloc malloc realloc in c?

595


Explain what is the difference between functions abs() and fabs()?

621


What is volatile variable how do you declare it?

567


What are the general description for loop statement and available loop types in c?

689