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 the meaning of keyword 'extern' in a function declaration.
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is the advantage of an array over individual variables?
What are # preprocessor operator in c?
How can I recover the file name given an open stream or file descriptor?
how to find anagram without using string functions using only loops in c programming
What is d scanf?
What is sizeof c?
What is difference between Structure and Unions?
What is the difference between union and anonymous union?
Is calloc better than malloc?
Why is c called c?
What is substring in c?
Why is it important to memset a variable, immediately after allocating memory to it ?
Describe newline escape sequence with a sample program?