How would I write a c program which will recursively compute the product of all even numbers greater than 0 and <= N, for values of N={16,7,9}, and print the results to an output file. For instance, if N=5, the product would be 4 x 2=8.

This recursive function in my program should accept a single value for N and for every call to that recursive function print out 1. how many times the recursive function has been called so far, 2. the value of the argument to the recursive function for this particular call, and 3. the value of the product so far(before the next recursive call). Main() is not the recurisve function. An example output for N=9 for what I want it to do might be:

Main: CALL ARGUMENT PRODUCT

RECU: 1 8 8
RECU: 2 6 48
RECU: 3 4 192
RECU: 4 2 384

MAIN: The product for N=5 is 8.

Here is what I got so far with the help of others but I still can't figure out how to printout how many times the function has been called, the value of the argument to the function for this call, and value of the product so far(BEFORE THE NEXT FUNCTION CALL). I can get it to just print ouf the product after the whole program is done, for instance N=9, the product of all it's even numbers is 8*6*4*2=384
Notice for the example call it prints out call 1, argument 8, and product 8(product 8 because the first number it gets is 8 and so there is no other numbers yet to multiply it to for the total)
Last I still can't also figure out how to get is to run through and find the product of all even numbers of each number 16,7,9. Maybe I need to use an array and I also need to clear the screen for each new number, like after 16, it clears it for the next value 7.
code:







#include <stdio.h>


int product_of_evens(int num)
{
static int call;
call++;

if (num<=0)
return 1;
if((num%2)==0)
{
return num*(product_of_evens(num-1));
}
else
{
return product_of_evens(num-1);
}

}



int main()
{
int num=9;
printf("\nTotal: %d\n",product_of_evens(num));
return 0;
}