Professional Documents
Culture Documents
COEN 3054
(DATA STRUCTURES and ALGORITHM)
EXERCISE
2
ARRAYS with FUNCTIONS
Submitted by:
________________________
Submitted to:
________________________
Date Submitted
_________________________
2. In the main function, declare and populate a 2 D array of integers with the
following numbers in the rows and columns as indicated
1234
4321
5678
8765
a. Call a function named PrintArray and pass the above array. The function will print
the array by line, appropriately labeled
b. Call a function named FindSum and pass the above array. The function will find
the sum of the numbers in the array and print it, appropriately labeled.
CUT AND PASTE THE SOURCE CODE AND CAPTURED OUTPUT SCREEN HERE.
Problem 3:
1. In the main function, create a 10 x 8 two dimensional array consisting of random integers in the
range 50 to 99, including the end points
2. Call a function named printArray that will print the array, appropriately labeled, 8 numbers per
line, with a space between each
3. Call a function named findSmallest that will find and print, appropriately labeled, the smallest
number in the array
4. Call a function named findAverage that will find and print, appropriately labeled, the average of
the numbers in the array
5. Call a function named findMode that will find and print, appropriately labeled, the number that
occurs most often. It there are ties, print only 1
6. Call a function named removeEvens, that will modify the array such that all even numbers are
replaced by the number 11
7. Call the function named printArray discussed in part 2 above and print the array as modified in
part 6 above.
CUT AND PASTE THE SOURCE CODE AND CAPTURED OUTPUT SCREEN HERE