Practice

Ends of a List

EASYArrays4 marks

Read six integers into an array with bounds 1 to 6. Output the first value, then the last value.

Input: Six integers. Output: Two lines, Values[1] then Values[6].

Example:

Input:  4
        8
        1
        1
        1
        9
Output: 4
        9

Sample Test Cases

Test 1: Different ends
Inputs: 4, 8, 1, 1, 1, 9
Expected: 4 9
Test 2: All the same
Inputs: 2, 2, 2, 2, 2, 2
Expected: 2 2