How can I write the algorithm in pseudocode to solve this problem:

There is 15 pupils in the introduction to programming 1 module. The age of every student is entered in years and months. Convert the age into months to calculate the average. Display the answer(Average age) and months on screen.

I have manage to write my Planning and IPO Chart, now I'm stuck... in algorithim "Processing step" where I have to convert age into months and calculate the average.

please I need help.

as usual, the average is the sum of all the ages, divided by the number of pupils. Count the pupils as they come in:

num_pupils = sum_of_ages = 0
loop {
read in years, months
num_pupils++
age_in_months = years*12 + months
sum_of_ages += age_in_months
}
average_age = sum_of_ages/num_pupils

Do the planning and write algorithm to solve for following problem.



There are 15 pupils in the Introduction to Programming I module. The age of every student is entered in years and months. Convert the age into months to calculate the average age. Display the ans

To solve this problem, you can follow these steps:

1. Initialize a variable `totalMonths` to 0.
2. For each pupil, do the following steps:
a. Prompt the user to enter the age of the pupil in years and months.
b. Convert the age into months by multiplying the number of years by 12 and adding the number of months.
c. Add the result to `totalMonths`.
3. Calculate the average age by dividing `totalMonths` by the number of pupils (15 in this case).
4. Display the average age on the screen.

Here is the pseudocode:

```plaintext
totalMonths = 0

for i = 1 to 15
print "Enter the age (in years and months) of pupil", i
read years, months

ageInMonths = (years * 12) + months
totalMonths = totalMonths + ageInMonths
end for

averageAge = totalMonths / 15

print "The average age is:", averageAge, "months"
```

You can now implement this pseudocode into your algorithm "Processing step" to convert the age into months and calculate the average age.