Exercise # 1
unknown
java
2 years ago
594 B
3
Indexable
1. Prompt user for the size of the array 2. Read size from the user 3. Create an array of integers with the given size 4. Generate random integers between 1 and 100 and fill the array 5. Print the generated array 6. Find the maximum value in the array 6.1. Call findMax function with the array, index 0, and initial maximum value 0 7. Print the maximum value FUNCTION findMax(arr, index, max) 1. IF index is equal to the length of arr 1.1. RETURN max 2. IF arr[index] is greater than max 2.1. SET max to arr[index] 3. RETURN findMax(arr, index + 1, max)
Editor is loading...