Question: Write a C program that has these 2 functions : Do not use goto, global variables or recursion. The output of the program should be
Write a C program that has these 2 functions:

Do not use goto, global variables or recursion.
The output of the program should be as follows:

O O . void printPreSumArray(int numArr[], int size); The second parameter size represents the number of elements in the first parameter array numArr. The function prints the prefix sum of the elements in numArr. For example if numArr is {2, 4, 3, 1}, then the function should print 2 6 9 10 because 2 = 2, 2 + 4 = 6, 2+ 4+ 3 = 9,2 + 4 + 3 + 1 = 10. int main(); The function prompts the user to enter the size of the array. If the size is not a positive integer, print an error message. Otherwise, creates an integer array of that size. Then the function assigns each element in the array an even number as 0, 2, 4, 6, 8, ..., and prints the array. Finally the function calls printPreSumArray using the array and its size to print the prefix sum of the elements in the array. O O O Example run 1: Enter the size of array: -6 Invalid array size Example run 2: Enter the size of array: 4 The array is: 0 2 4 6 The prefix sum of the array is: 0 2 6 12 Example run 3: Enter the size of array: 5 The array is: 0 2 4 6 8 The prefix sum of the array is: 0 2 6 12 20 Example run 4: Enter the size of array: 8 The array is: 0 2 4 6 8 10 12 14 The prefix sum of the array is: 0 2 6 12 20 30 42 56
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
