1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.
1- Write a user-defined function that accepts an array of integers. The function should generate
the percentage each value in the array is of the total of all array values. Store the % value in
another array. That array should also be declared as a formal parameter of the function.
2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user
to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end
of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it
could be partially filled).
3- Display a table like the following example, showing each data value and what percentage
each value is of the total of all array values. Do this by invoking the function in part 1.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images