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 |
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }
what is data structure
what is the basis for selection of arrays or pointers as data structure in a program
How are structure passing and returning implemented?
write a program that print itself even if the source file is deleted?
Explain the process of converting a Tree into a Binary Tree.
What extern c means?
Can a file other than a .h file be included with #include?
what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }
How. To pass the entrance test
is it possible to change the default calling convention in c ?
what will be the output off the following program? #include<stdio.h> int main() { int a; a=015+0*71+5; printf("%d,a"); return0; }