Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15722


write a program for the normal snake games find in most of the mobiles.

2211


find the sum of two matrices and WAP for it.

1065


Tell us the use of fflush() function in c language?

1083


Do pointers take up memory?

1077


shorting algorithmS

2192


What are pointers in C? Give an example where to illustrate their significance.

1166


difference between Low, Middle, High Level languages in c ?

2023


What is the difference between pure virtual function and virtual function?

1064


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1324


How can you increase the size of a dynamically allocated array?

1128


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

1054


Explain how can you be sure that a program follows the ansi c standard?

1393


What is void pointers in c?

954


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

1087