1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ksju [112]
3 years ago
10

Write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of each

month, such as June or July, and the amount of rain (in inches) that fell each month. The program should display a message similar to the following: The average rainfall for June, July, and August is 6.72 inches.
Computers and Technology
1 answer:
sergeinik [125]3 years ago
4 0

Answer:

// program in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // string array

   string m[3];

   // array to store rainfall

   double rainfall[3];

   // variables

   double avg_rainfall,sum=0;

   

   for(int i=0;i<3;i++)

   {

       cout<<"Enter name of month "<<i+1<<" :";

       // read month name

       cin>>m[i];

       cout<<"Enter rainfall (inches)  in month "<<i+1<<" :";

       // read rainfall

       cin>>rainfall[i];

       // sum of rainfall

       sum+=rainfall[i];

   }

   // Average rainfall

   avg_rainfall=sum/3;

   // print Average rainfall

   cout<<"Average rainfall for "<<m[0]<<","<<m[1]<<","<<m[2]<<" is "<<avg_rainfall<<" inches."<<endl;

return 0;

}

Explanation:

Create string array "m" to store name of month and double array "rainfall" to store rainfall. Read name of 3 months and rainfall in that month.Find the sum of all the rainfall  and the average rainfall.Print the average rainfall of 3 months.

Output:

Enter rainfall (inches)  in month 2 :45                                                                                    

Enter name of month 3 :july                                                                                                

Enter rainfall (inches)  in month 3 :43                                                                                    

Average rainfall for may,june,july is 42.6667 inches.

You might be interested in
QUESTION 5
Zepler [3.9K]

Answer:

allows users to accomplish tasks such as create text documents.

Explanation:

8 0
2 years ago
What is the relationship between agile teams and project requirements
spin [16.1K]

Answer:

Agile follows a non-linear process, unlike conventional project management, which focuses more on teamwork, cooperation, and versatility, as opposed to a strict sequence of activities.Agile project management takes an iterative approach to project management, which time-boxes tasks into fast sprints.

Explanation:

4 0
3 years ago
Urgent help<br> Write a program that prints ‘Hello World’ to the screen
lapo4ka [179]
Class newprog
 { 
      public static void main()
       {

                 System.out.println("Hello world");
              }
}
4 0
4 years ago
How many grams are in 100 pounds?
stepan [7]

Answer:

45359.2 grams are in 100 pounds

Explanation:

Hope this helped, Have a Wonderful Day!!

3 0
3 years ago
Read 2 more answers
. Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
arlik [135]

Answer: A: Switches

Explanation:

6 0
3 years ago
Other questions:
  • When the packet leaves the router, which source and destination ip addresses will be contained in the packet?
    9·1 answer
  • How can i use css/html coding to create links
    15·1 answer
  • Suppose that you created an robot that was so advanced it could act independently in very complex situations. It made its own de
    9·1 answer
  • 2. Billys teacher asked him to type a report about asian food. Which paragraph format should he use?
    12·2 answers
  • What’s the answer to this question?
    15·1 answer
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • An accompanying ____ gives audience members reference notes and review material for your presentation.
    6·1 answer
  • In C++ write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE
    13·1 answer
  • Project manager George is defining project management to his team. How should he define project management in one sentence?
    7·1 answer
  • No down payment, 18 percent / year, payment of $50/month, payment goes first to interest, balance to principal. Write a program
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!