Question: Develop a program to calculate and display the average rainfall over a certain number of years. Program Steps: User Input for Years: Ask the user
Develop a program to calculate and display the average rainfall over a certain number of years.
Program Steps:
User Input for Years:
Ask the user to enter the number of years for which they will provide rainfall data.
Data Collection:
Loop through each year outer loop
Within each year, loop through each month inner loop totaling iterations.
For every month, prompt the user to input the rainfall amount. Include the name of the month in the prompt to make it userfriendly.
Accumulate the rainfall data for total and average calculations.
Calculations:
Compute the total number of months across all years.
Calculate the total rainfall by summing all user inputs.
Determine the average monthly rainfall by dividing the total rainfall by the total number of months.
Display Results:
Present to the user:
The overall total number of months.The complete accumulated rainfall in inchesThe average rainfall per month over the entire period.
Ensure to utilize nested loops for data collection and keep the user prompt clear by incorporating the month's name. This program should efficiently compile all input data to provide accurate calculations and clear output at the end.
Display the Output:
When you finish coding, execute the code for three years. Enter numbers as you wish for each month. Numbers are not important. It is important to see if your code can generate two loops one for the years, and another for the months.
The example output below is only for one year. Your output should display three years.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
