COMP1602 Lab4.pdf - COMP 1602 Computer Programming II Lab 4 1 The range of a list of numbers is the difference between the largest and smallest values

# COMP1602 Lab4.pdf - COMP 1602 Computer Programming II Lab 4...

This preview shows page 1 - 2 out of 2 pages.

COMP 1602: Computer Programming II Lab 4 1. The range of a list of numbers is the difference between the largest and smallest values. Write a function which accepts an array of integers and the size of the array as parameters and calculates and returns the range of the numbers in the array. 2. Write a function which accepts two integer arrays with the same number of elements and their size as parameters, and returns true if the first array is equal to the second array and false , otherwise. Two arrays are considered equal if the corresponding elements are the same. 3. The dot product of two arrays a and b , each of size n , is the sum of the product of a[i] and b[i] for i = 0 to n - 1. For example if double a = {1.0, 3.5, 2.0}; double b[3 ] = {2.5, 2.0, 3.0}; then the dot product of a and b is (1.0 * 2.5) + (3.5 * 2.0) + (2.0 * 3.0) = 2.5 + 7.0 + 6.0 = 15.5. Write a function that takes two arrays and their size as parameters and returns the dot product of the arrays. The arrays hold double values and are both of the same size .  #### You've reached the end of your free preview.

• • •  