Design a program that lets the user enter the total rainfall for each 12 months into an array. The program should calculate and display the total rainfall for the year the average monthly rainfall, and the month with the highest and lowest amounts.

In pseudo-code and a flowchart

2 answers

first column = n = month number from 1 to 12
second column = rainfall for n R(n)
third column = total rain so far
Rmin = 5000 (unrealistic high)
Rmax = 0
Rav = 0
Rtot = 0
Do loop A for n = 1, 12
Read R(n)
If R(n) > Rmax, then Rmax = R(n)
If R(n) < Rmin, then Rmin = R(n)
Rtot = Rtot + R(n) (this is total so far)
Rav = Rtot/n (this is the average so far)
write n, R(n),Rtot, Rav, Rmax, Rmin
A end of loop
end
1, 12