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
What type of function is main ()?
How can I delete a file?
What is atoi and atof in c?
What is hash table in c?
what is the significance of static storage class specifier?
Difference between macros and inline functions? Can a function be forced as inline?
What is the size of array float a(10)?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What are the advantages of c preprocessor?
What does double pointer mean in c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
What is difference between arrays and pointers?
Give differences between - new and malloc() , delete and free() ?
Why c is called procedure oriented language?
What are the basic data types associated with c?