Average Rainfall Design a pseudocode program that uses nested loops to collect d
ID: 3771381 • Letter: A
Question
Average Rainfall
Design a pseudocode program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. Submit either a Flowchart or Pseudocode . (No java libraries!) Just Pseudocode with javascript
Explanation / Answer
Pseudocode :
Display "Enter no. of years"
Read n_o_y
total <- 0
n_o_m <- n_o_y * 12
Loop from 1 to n_o_y :
Loop from 1 to 12 :
Read rainfall
total <- total + rainfall
End Loop
End Loop
Average <- total / n_o_m
Diplay "Number of Months" + n_o_m
Display "Total Rainfall" + total
Display "Average Rainfall" + Average
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.