Question: Write a C program that calculates and displays the factorial of each element in an integer array. 1. In the main function, the program

Write a C program that calculates and displays the factorial of each element in an integer array. 1. In the main function, the program will ask the user to enter the length of array and the elements of the array. 2. The program should include a recursive factorial function (provided in the lecture slides). int fact (int n); 3. As part of the solution, create a function calculate_fact() with the following prototype. n is the size of the arrays. array a represents the input array, and array b represents the output array. The function calls the fact function to calculate the factorial of an element. void calculate_fact (int a[], int n, int b[]); 4. The main function calls the calculate_fact() function and displays the output. Example: Enter the length of the array: 4. Enter the elements of the array: 251 3 Output: 2 120 16
Step by Step Solution
There are 3 Steps involved in it
1 Here is the C program that calculates and displays the factorial of each element in an integer arr... View full answer
Get step-by-step solutions from verified subject matter experts
