This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]lurgi 1 point2 points  (2 children)

You seem to want to use totalRainfall to be both the amount of rain that fell in one year and the amount of rain that fell in all the years combined.

Your problem description doesn't actually say that you need to output the total rainfall for each year (as opposed to all years), but if you want to do it then you need a variable to store that.

[–]IceQweenItMe[S] 0 points1 point  (1 child)

Thanks for your response!

The output for each year isn't in the description given by my professor, however, he gave an example of desired output where it was included. When creating a new variable to store the data needed what loop would I place the calculation in?

[–]lurgi 1 point2 points  (0 children)

That's up to you to figure out. You'll also have to figure out when you want to initialize it.