← Back to Structs
Question 244
Array of Students: List and Average
Array of Students: List and Average
Define a struct type named Student with a text field name and an integer field grade. Create an array of 3 Students: Ann with 85, Ben with 90, and Cara with 95. Loop over the array printing each student as name: grade on its own line, then print the average grade (integer division of the total by 3) as Average: 90 on a final line. Each line ends with a newline. This combines an array of structs with a running total.
Expected Output:
Ann: 85 Ben: 90 Cara: 95 Average: 90
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.