Practice

Highest Student Record

MEDIUMData Types8 marks

Define a record type named Student with a name and integer mark. Read three student records and output the name and mark of the student with the highest mark.

If marks are equal, keep the student who was entered first.

Input: Three pairs of name and mark. Output: The winning name followed by the mark on the next line.

Example:

Input:  Amal
        71
        Ben
        88
        Chen
        79
Output: Ben
        88
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Second student highest
Inputs: Amal, 71, Ben, 88, Chen, 79
Expected: Ben 88
Test 2: First student highest
Inputs: Ari, 95, Bea, 80, Cal, 90
Expected: Ari 95