write a c program to add two integer numbers without using
arithmetic operator +

Answer Posted / maksim

a = 53;
int c = 0b10000000;
int d = c;
printf("c=%d\n",c);
s = 30;

while(c>0){
int d = c;
if (a&d){
while ((s&d)&&(d<=128)) {
s = (s&~d);
d = d<<1;
}
d = (d<=128)?d:0;
s = s|d;
}
c = c>>1;
}
printf("s=%d\n",s);

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is c not oop?

541


Why functions are used in c?

592


how to find anagram without using string functions using only loops in c programming

2720


Why we use stdio h in c?

587


Is that possible to store 32768 in an int data type variable?

694






Combinations of fibanocci prime series

1116


Which is best linux os?

568


What are the types of data structures in c?

606


What is quick sort in c?

588


What library is sizeof in c?

576


What is null pointer constant?

598


Why clrscr is used after variable declaration?

1045


program to convert a integer to string in c language'

1988


What is nested structure with example?

629


Explain the use of 'auto' keyword

681