Practice

Reverse an Array

EASYArrays5 marks

Read five integers into an array, then output them in reverse order with one value per line.

Input: Five integers on separate lines. Output: The same five integers in reverse order.

Example:

Input:  10 20 30 40 50
Output: 50
        40
        30
        20
        10
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Ascending values
Inputs: 10, 20, 30, 40, 50
Expected: 50 40 30 20 10
Test 2: Descending values
Inputs: 5, 4, 3, 2, 1
Expected: 1 2 3 4 5