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 / sanjay bhosale

int x=12382,y=2;
int xor, and, temp;
and = x & y;
xor = x ^ y;

while(and != 0 )
{
and <<= 1;
temp = xor ^ and;
and &= xor;
xor = temp;
}
printf(" sum is : %d",xor);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data structure in c language?

1104


Why ca not I do something like this?

1007


What is a wrapper function in c?

1113


Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

6861


Why c language?

1054


What is the difference between variable declaration and variable definition in c?

1054


What is structure padding in c?

1127


What are actual arguments?

1083


Explain what is the use of a semicolon (;) at the end of every program statement?

1221


What is the purpose of main( ) in c language?

1132


How many loops are there in c?

1107


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1964


Why do we use pointer to pointer in c?

1082


Is it better to use a macro or a function?

1154


What is file in c preprocessor?

1142