/*------------------------------------------------------------------------------ * File: Problem1.c * Function: Calculate the product of two even numbers * Description: This C program calculates the product of two even numbers and outputs the results in the * form "2 times 8 is 16" * Input: None * Output: "2 times 8 is 16" * Author(s): Noah Woodlee * Lab Section: 09 * Date: Aug 20, 2021 *----------------------------------------------------------------------------*/ #include #include int prod(int f, int s, int c, int p); int main() { //Intialize variables int first = 4; int second = 8; int counter = 0; int pr = 0; int product = 0; //Call loop product =prod(first,second,counter,pr); //Print output printf ("%d times %d is %d\n", first,second,product); } int prod(int f, int s, int c, int p){ p =p+ f; //Add first number to product c=c+1; //Increment counter by 1 if (c!=s) p= prod(f,s,c,p); // If counter is not equal to the second number, // call the function agian return p; }