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 copy files?
What is static memory allocation?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
What are the three constants used in c?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is the use of a conditional inclusion statement in C?
provide an example of the Group by clause, when would you use this clause
Which header file is essential for using strcmp function?
Are local variables initialized to zero by default in c?
can we have joblib in a proc ?
Is c language still used?
What is scanf_s in c?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
Explain the difference between #include "..." And #include <...> In c?