A school is organising a charity walk. Each student collects sponsorship money based on the number of kilometres they walk.
You are required to write an algorithm that:
Asks for the number of students taking part.
For each student:
Inputs the number of kilometres walked.
Inputs the amount sponsored per kilometre.
Calculates the total money raised by that student.
Keeps a running total of the money raised by all students.
At the end, outputs:
The total amount of money raised by all students.
The average amount raised per student, rounded to 2 decimal places.
Student
Kilometres
Amount per km
1
5
2.50
2
8
1.75
3
4
3.00
Write an algorithm using pseudocode or a programming language of your choice that solves this problem.
Your solution should:
Use a loop to process each student.
Use appropriate variables with meaningful names.
Perform correct calculations.
Display the final outputs clearly.