How to add two numbers without using arithmetic operators?
Answer Posted / roopali
#include<stdio.h>
int sum(int num1, int num2);
int main()
{
int num1, num2, result;
printf("Enter the number:");
scanf("%d%d",&num1,num2);
result=sum(num1,num2);
printf("The sum of two numbers is:%d",result);
return 0;
}
int sum(int num1, int num2)
{
int i;
for(i=0;i<num2;i++)
{
num1++;
}
return num1;
}
| Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
What are structure members?
What is the process to create increment and decrement stamen in c?
What is a pointer and how it is initialized?
Explain about the constants which help in debugging?
What does %2f mean in c?
How can a number be converted to a string?
What is class and object in c?
Is flag a keyword in c?
Why should I use standard library functions instead of writing my own?
What are the types of bitwise operator?
What does *p++ do?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Is that possible to add pointers to each other?
What is graph in c?
What kind of structure is a house?