Practice

Find Minimum in Array

2023/Oct/Nov·Variant 2·Q3(b)·[4 marks]
EASYArrays

Read 10 integers (each between -20 and 100 inclusive) into a 1D array. Using a single loop, find and output the lowest value.

Source: Inspired by 2023 Oct/Nov Variant 2 Q3(b)

Input: 10 integers on separate lines. Output: The minimum value.

Example:

Input:  5
        3
        -1
        10
        7
        2
        -20
        8
        4
        6
Output: -20
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Min is negative
Inputs: 5, 3, -1, 10, 7, 2, -20, 8, 4, 6
Expected: -20
Test 2: Min is first
Inputs: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
Expected: 10
Test 3: Min is last
Inputs: 50, 50, 50, 50, 50, 50, 50, 50, 50, 1
Expected: 1
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade