How to add two numbers without using arithmetic operators?
Answer Posted / selloorhari
#include <stdio.h>
int add(int a, int b)
{
if (!a)
return b;
else
return add((a & b) << 1, a ^ b);
}
int main()
{
unsigned int a,b;
printf("Enter the two numbers: \n");
scanf("%d",&a);
scanf("%d",&b);
printf("Sum is: %d",add(a,b));
}
| Is This Answer Correct ? | 168 Yes | 30 No |
Post New Answer View All Answers
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
write a program for the normal snake games find in most of the mobiles.
find the sum of two matrices and WAP for it.
Tell us the use of fflush() function in c language?
Do pointers take up memory?
shorting algorithmS
What are pointers in C? Give an example where to illustrate their significance.
difference between Low, Middle, High Level languages in c ?
What is the difference between pure virtual function and virtual function?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
How can you increase the size of a dynamically allocated array?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Explain how can you be sure that a program follows the ansi c standard?
What is void pointers in c?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none