Practice Exercise 9
More Array Exercises

Objective: To become familiar with array handling.

Exercise 1:

Write a function that returns the difference between the largest and smallest elements in an array of integers. Test the  function in a simple program.

Exercise 2:

Write a sub that sets each element in array to the sum of the corresponding elements in two other arrays. That is, if array 1 has the values 2, 4, 5, and 8 and array 2 has the values 1, 0, 4, and 6, the sub assigns array 3 the values 3, 4, 9, and 14. The sub should take three array names and an array size as arguments. Test the function in a simple program.

Sample Solution