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...


sir i wanted to know how we wap in c to add numbers without
using arithmetic operator in which digits are entered by
user?

Answers were Sorted based on User's Feedback



sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which dig..

Answer / niranjan vg

#include<stdio.h>

int main()
{
int a,b,sum,carry;
printf("\n Enter the numbers : ");
scanf("%d%d",&a,&b);
sum=a^b;
carry=a&b; // Produce a extra carry bit if present
while(carry!=0)
{
carry<<=1; // shift for every iteration so
that it gets added with the next digit
a=sum;
b=carry;
sum=a^b; // perform Xor Operation
carry=a&b; // Calculate the new value for carry
}
printf("\n The sum is %d", sum);
}

Is This Answer Correct ?    3 Yes 1 No

sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which dig..

Answer / sheshivardhan reddy.rayala

using aadd()function we can add the arguements without
using arithmetic operator

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

how to convert binary to decimal and decimal to binary in C lanaguage

7 Answers   BPO, Far East Promotions, IBM, RBS,


will the program compile? int i; scanf(ā€œ%dā€,i); printf(ā€œ%dā€,i);

3 Answers  


List some of the dynamic data structures in C?

0 Answers  


Explain how can I pad a string to a known length?

0 Answers  


What are .h files and what should I put in them?

3 Answers  


what is the hardware model of CFG( context free grammar)

0 Answers   Microsoft,


What is #error and use of it?

0 Answers  


What is const volatile variable in c?

0 Answers  


Is there sort function in c?

0 Answers  


What are the 4 types of unions?

0 Answers  


What is macro?

5 Answers   IBM,


Why isnt there a numbered, multi-level break statement to break out

0 Answers  


Categories