How to add two numbers without using arithmetic operators?
Answer Posted / srinu
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i,j,k=0;
printf("enter 2 numbers");
scanf("%d%d",&a,&b);
if(a>b)
{
k=b;
for(i=1;i<=a;i++)
k++;
}
else
{
k=a;
for(j=1;j<=b;j++)
k++;
}
printf("sum of 2 numbers is %d",k);
}
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Find MAXIMUM of three distinct integers using a single C statement
What is the maximum length of an identifier?
What is strcmp in c?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
What is the difference between union and anonymous union?
What is the difference between int main and void main?
please send me the code for multiplying sparse matrix using c
Can two or more operators such as and be combined in a single line of program code?
Does c have an equivalent to pascals with statement?
What math functions are available for integers? For floating point?
explain how do you use macro?
How can you determine the maximum value that a numeric variable can hold?
Why pointers are used?
Explain how do you override a defined macro?
What is c language used for?