Question

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.

Answers

Steve

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
Anonymous
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

Related Questions