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 |
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);
List some of the dynamic data structures in C?
Explain how can I pad a string to a known length?
What are .h files and what should I put in them?
what is the hardware model of CFG( context free grammar)
What is #error and use of it?
What is const volatile variable in c?
Is there sort function in c?
What are the 4 types of unions?
What is macro?
Why isnt there a numbered, multi-level break statement to break out