Question: Write a program in C that contains 5 functions as follows. Function #1 Read integers from the command line into an array of integers. Function
Write a program in C that contains 5 functions as follows.
Function #1 Read integers from the command line into an array of integers.
Function #2 Print an array of integers, with integers separated by a space.
Function #3 Summarize an array of integers by printing information including array length (i.e. how many elements are there in the array), the max and min numbers in the array, the sum and average (formatted to 2 decimals) of all integers of the array.
Function #4 Search an array of integers for a given integer. Return the position of the integer in the array or -1 if the integer is not found.
In the main function, read a positive integer between 1 and 10 inclusive. This number represents the number of integer elements that you will read into an array. Create the array.
Call Function #1 to load data into the array. Call Function #2 to print the elements in the array. Call Function #3 to print the summary of the array. Finally, read an integer from the user and call Function #4 to search it, print the result. Keep on searching new integers until the user enters an -1. In your program you can assume that the user will be giving only integers all the time.
Do NOT use goto statement, recursive functions, or global variables.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
