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
Why is c still so popular?
What is default value of global variable in c?
What is a good way to implement complex numbers in c?
What is the purpose of sprintf?
What does %d do in c?
What is else if ladder?
Is c compiled or interpreted?
Write a program to reverse a given number in c language?
Difference between MAC vs. IP Addressing
Whats s or c mean?
What is the difference between near, far and huge pointers?
What are static variables in c?
What is a c token and types of c tokens?
What is graph in c?
Why doesnt the call scanf work?