Asked by javane
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
In pseudo-code and a flowchart
Answers
Answered by
Damon
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
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
Answered by
cordell
1, 12
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.