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
Simplify the program segment if X = B then C ← true else C ← false
Dont ansi function prototypes render lint obsolete?
Explain what is the benefit of using an enum rather than a #define constant?
What does c in a circle mean?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What is a structure and why it is used?
How does normalization of huge pointer works?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
Where in memory are my variables stored?
Tell us something about keyword 'auto'.
Why is c platform dependent?
What is pointers in c with example?
Explain the difference between call by value and call by reference in c language?
What is file in c preprocessor?