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
How do I swap bytes?
What is methods in c?
what is ur strangth & weekness
if p is a string contained in a string?
What is const keyword in c?
What is boolean in c?
What is a ternary operator in c?
What is the best organizational structure?
What is time complexity c?
What are the types of functions in c?
What are the 5 organizational structures?
Why we use stdio h in c?
Explain what is the most efficient way to store flag values?
Explain the use of bit fieild.
Explain the difference between structs and unions in c?