Practice

Highest, Smallest, Total and Average

2025/Feb/Mar
MEDIUMAlgorithms

Write an algorithm that takes 5 positive integers as input, finds the highest and smallest values, calculates their total, and outputs the average rounded to 2 decimal places.

Input: 5 positive integers. Output: Four lines: the highest number, the smallest number, the total, and the average.

Example:

Input:  10
        20
        30
        40
        50
Output: The highest number is 50
        The smallest number is 10
        The total is 150
        The average is 30
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Ascending
Inputs: 10, 20, 30, 40, 50
Expected: The highest number is 50 The smallest number is 10 The total is 150 The average is 30
Test 2: All identical
Inputs: 5, 5, 5, 5, 5
Expected: The highest number is 5 The smallest number is 5 The total is 25 The average is 5
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade