Question: Program: Write a C program that uses the following double array: double userdatal6]-1-5.1,-2.9, 2.7, 8.3,-3.1, 9.9) The program will call a function named: array_sum that
Program: Write a C program that uses the following double array: double userdatal6]-1-5.1,-2.9, 2.7, 8.3,-3.1, 9.9) The program will call a function named: array_sum that takes the array and number of array elements as input and prints (but does NOT return) the sum of all the values (as a double) to 2 decimal places. (NOTE: The function array_sum returns nothing, it just calculates and displays the sum to 2 decimal places.) The function should be general enough to work for a double type array of any size For partial credit (-4 points), this can all be done within main() instead of as a function. Suggestion: Get the program to work all within main() initially, then move the array-processing code into its own function. The program is to run gracefully with clearly-labeled inputs and outputs and the code should be easy to follow (comments, etc.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
