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
Explain how can I make sure that my program is the only one accessing a file?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
What is class and object in c?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
how is the examination pattern?
Why is structure important for a child?
Explain what are the __date__ and __time__ preprocessor commands?
What are # preprocessor operator in c?
How pointer is different from array?
Write a program to print "hello world" without using a semicolon?
What is || operator and how does it function in a program?
How can I call fortran?
List out few of the applications that make use of Multilinked Structures?
What functions are in conio h?
Why is %d used in c?