CISC 1110 Lab 14
Write a simple program to process an array.
A. First, declare an array nums with room for 10 integer values. Declare a variable n which will hold the number of values you plan to put into the array.
In the main program, read a value for n from the keyboard (make that value small, perhaps 5) and read n data values to fill all the positions in the array. Print each data value in the loop as you read it in.
If we do not get as far as using arrays in functions,
do B (loop)
do C (function)
B. Then, in a second loop, sum the n values in the array nums and print the sum.
C. Write a function addup that receives one integer array parameter (which it calls arr) and one integer parameter (which it calls n). The function will sum the n elements in the array arr. Then the function will return the sum to the calling program.
From main, send the array and n to the function addup which will sum the n elements in the array. After the function returns, the main program should print the answer which has been returned, together with a message.
Above the main program, include a prototype for the function addup.
Run the program.