Please write a simple C program for the following requiremen
Please write a simple C program for the following requirement:
- Write a recursive function to compute the product of all even numbers smaller than a given number. That is if the function is called with 6, it will return 2*4=8.
Thank you for the help!
Solution
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void product(int n)
{int product = 1,i;
for(i=2;i<n;i++)
{
if(i%2==0)
{product = product*i;}
}
printf(\"The product of all even numbers less than given number is%d\",&product);
}
void main()
{
int number;
printf(\"Enter the number\");
scanf(%d,&number);
}
