Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Average Rainfall. Write a program that calculates the average rainfall for three

ID: 3609424 • Letter: A

Question

Average Rainfall. Write a program that calculates the average rainfall for threemonths. The program should ask the user to enter the name of eachmonth, such as June or July, and the amount of rain (in inches)that fell each month. The program should display a message similarto the following: The average rainfal for June, July, and August is 6.72inches. Average Rainfall. Write a program that calculates the average rainfall for threemonths. The program should ask the user to enter the name of eachmonth, such as June or July, and the amount of rain (in inches)that fell each month. The program should display a message similarto the following: The average rainfal for June, July, and August is 6.72inches. Write a program that calculates the average rainfall for threemonths. The program should ask the user to enter the name of eachmonth, such as June or July, and the amount of rain (in inches)that fell each month. The program should display a message similarto the following: The average rainfal for June, July, and August is 6.72inches.

Explanation / Answer

I hope it will surely work for you.
#include<iostream.h> #include<conio.h>
char
month1[10], month2[10], month3[10];
float
r1 = 0.00,
r2 = 0.00,
r3 = 0.00,
avg = 0.00;

cout << " Enter name of the month : ";
cin >> month1;
cout << " Enter the rain fall for the month of "<<month1 << " : ";

cin >> r1;
cout << " Enter name of the 2nd month : ";
cin >> month2;
cout << " Enter the rain fall for the monthof "<< month2 << " : ";

cin >> r2;
cout << " Enter name of the 3rd month : ";
cin >> month3;
cout << " Enter the rain fall for the monthof "<< month1 << " : ";

cin >> r3;

avg = (r1 + r2 + r3)/3;

cout << " Average rain fall for "<< month1<<" , "<< month2 <<" , "<< month3 <<" is " << avg << " inches" << " ";

} month1[10], month2[10], month3[10];
float
r1 = 0.00,
r2 = 0.00,
r3 = 0.00,
avg = 0.00;

cout << " Enter name of the month : ";
cin >> month1;
cout << " Enter the rain fall for the month of "<<month1 << " : ";

cin >> r1;
cout << " Enter name of the 2nd month : ";
cin >> month2;
cout << " Enter the rain fall for the monthof "<< month2 << " : ";

cin >> r2; cout << " Enter name of the 2nd month : ";
cin >> month2;
cout << " Enter name of the 3rd month : ";
cin >> month3;
cout << " Enter the rain fall for the monthof "<< month1 << " : ";

cin >> r3;

avg = (r1 + r2 + r3)/3;

cout << " Average rain fall for "<< month1<<" , "<< month2 <<" , "<< month3 <<" is " << avg << " inches" << " ";

} cout << " Enter name of the 3rd month : ";
cin >> month3;
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote