Question: Assignment 4: Functions Please complete the program described below. You will turn in to the dropbox: - The code, as a plaintext file (use cat

 Assignment 4: Functions Please complete the program described below. You willturn in to the dropbox: - The code, as a plaintext file

Assignment 4: Functions Please complete the program described below. You will turn in to the dropbox: - The code, as a plaintext file (use cat filename.c to print out the file. Highlight it to copy, then paste into a text editor) - A screenshot of the code running with your name included The file must be named func.c located in a folder called a4 in yourhome directory You will write several functions. Please complete the specified functions below, then show example output for the functions in your main. Below are the function descriptions, and a function prototype to use. Your implementation should use these parameters and return types ONLY. (You can use different naming conventions, but you should not add, remove, or change parameters and return types) . You must use function prototypes as discussed in class. Below, you can find a sample main you can use in your own program. Do NOT use any outside libraries such as math.h to solve these functions. You must write the solutions yourself. 1) Power: Calculate the exponent given. No need to worry about handling negative powers, just think about powers that are 0 or greater. You do not need to scan input in main, you can hard code a value to test for your function. int power(int base, int exponent); 2) Factorial: Calculate the factorial of a number. (The factorial of a number is the product of the given number and all preceding numbers, so 5!=54321 ) You do not need to scan input in maim, you can hard code a value to test your function. int factorial(int num); 3) Scan and Print Reverse: Scan in an array of variable size. Then, print out the array in reverse order. Unlike the other two functions, this must take in input from the user. void scanAndReverse(int arr[], int n ); BONUS: Some bonus points can be earned here. Implement this function by using different smaller functions for each distinct part of the problem, instead of all in the same function. This way, our scanAndReverse function stays much more concise, splitting up the work into smaller pieces for other functions to handle. (Hint: the function has two subproblems to tackle: Scanning, and printing)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!