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
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 |
Answer / sheshivardhan reddy.rayala
using aadd()function we can add the arguements without
using arithmetic operator
| Is This Answer Correct ? | 1 Yes | 2 No |
what is the difference between postfix and prefix unary increment operators?
How can I set an array's size at run time?
i have a written test for microland please give me test pattern
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }
c program to manipulate x=1!+2!+3!+...+n! using recursion
what is an inline function?
Who is the main contributor in designing the c language after dennis ritchie?
what is the differance between pass by reference and pass by value.
what is use#in c
in which language c language is written?
Where does the name "C" come from, anyway?