Program to find Factorial of a Number using Recursion
C Program to Find Product of 2 Numbers using Recursion
Problem Description
This C program finds the product of 2 numbers using recursion.
Problem Solution
This C program using recursion, finds the product of 2 numbers without using the multiplication operator.
Program/Source Code
#include
int product(int, int);
int main()
{
int a, b, result;
printf("Enter two numbers to find their product: ");
scanf("%d%d", &a, &b);
result = product(a, b);
printf("Product of %d and %d is %d\n", a, b, result);
return 0;
}
int product(int a, int b)
{
if (a < b)
{
return product(b, a);
}
else if (b != 0)
{
return (a + product(a, b - 1));<.... Show More
All Chapters — C programming
Similar Questions
From Recursive program in c · C programming
Program to find Palindrome using Recursion
Program to print Fibonacci Series using Recursion
C Program to Print Binary Equivalent of an Integer using Recursion
C Program to Find Reverse of a Number using Recursion
C Program to Find Sum of Digits of a Number using Recursion
C Program to find LCM of two Numbers using Recursion
C Program to Find Sum of N Numbers using Recursion