Exam 2 Programming in C

Write the following functions:

Write a program that randomly generates a size of the array, integer between 5 and 20, array of integers (each element in range -10 to 10) and the replacement value (an integer in range -10 to 10)

The program prints all randomly generated data.

The program then uses function ave_even to find and print an average of all elements with EVEN index and uses function ave to find and print an average of all elements. Then the program uses function replace_even to replaces ALL even elements of the array with replacement value. The program prints an updated array after replacement was done and calculates and prints again both averages

Example:
size = 5
array: -3 5 1 0 8
replacement_value: -3


Output:
average of all elements: 2.2
average of all elements with even index: 2.0
array after replacement: -3 5 1 -3 -3
average of all elements after replacement: -0.6
average of all elements with even index after replacement: -1.666667