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
kari74 [83]
3 years ago
9

Create an array to hold the rainfall values. Create a 2nd parallel array (as a constant) to hold the abbreviated names of the mo

nths. I created my arrays to be 1 element bigger than needed, and then disregarded element [0] (so that my months went from [1] = "Jan" to [12] = "Dec").
Computers and Technology
1 answer:
Zarrin [17]3 years ago
4 0

Answer:

#include <stdio.h>

int main()

{

//variable declaration

int low, high;

float lowRain, highRain, total, avg;

 

//array declaration

float rainfall[13];

char monthName[13][10] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

//get user input

for(int i=1; i<=12; i++)

{

printf("Enter the rainfall (in inches) for %s: ", monthName[i]);

scanf("%f", &rainfall[i]);

}

 

//display the monthly rainfall

printf("\nThe rainfall that was entered was:\n");

for(int i = 1; i<=6; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 1; i<=6; i++)

printf("%.1f ", rainfall[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%.1f ", rainfall[i]);

 

//variable initialization

low = 1;

high = 1;

lowRain = rainfall[1];

highRain = rainfall[1];

total = 0;

 

//calculate the lowest, highest and averaage rainfall

for(int i=1; i<=12; i++)

{

if(lowRain>rainfall[i])

{

lowRain = rainfall[i];

low = i;

}

if(highRain<rainfall[i])

{

highRain = rainfall[i];

high = i;

}

total = total + rainfall[i];

}

 

avg = total / 12;

 

//display the result

printf("\n\nThe total rain that fell was %.1f inches", total);

printf("\nThe average monthly rainfall was %.1f inches.", avg);

printf("\nThe lowest monthly rainfall was %.1f inches in %s.", rainfall[low], monthName[low]);

printf("\nThe highest monthly rainfall was %.1f inches in %s.", rainfall[high], monthName[high]);

return 0;

}

You might be interested in
Which of the following was the name of the first generation of cell phone networks?
coldgirl [10]

Answer:

1G

Explanation:

1 'G' as in first generation.

Hope this helped. :)

3 0
3 years ago
Atheel tests a program and gets a NameError. How can this be fixed?
Oksana_A [137]

Answer:

You can't call a function unless you've already defined it. Move the def createDirs(): block up to the top of your file, below the imports.

Explanation:

Some languages allow you to use functions before defining them. For example, javascript calls this "hoisting". But Python is not one of those languages.

7 0
3 years ago
Read 2 more answers
Which of the following statements expresses why the following code is considered bad form? for (rate = 5; years-- &gt; 0; System
OlgaM077 [116]

Answer:

l and ll only that is the answer

7 0
3 years ago
Read 2 more answers
Describe how computer are used in ticket counter?​
m_a_m_a [10]

Answer:

These systems are commonly used in facilities such as public libraries to ensure equitable use of limited numbers of computers. Bookings may be done over the internet or within the library itself using a separate computer set up as a booking terminal.

6 0
3 years ago
Instructions:Select the correct answer.
lana [24]
You should follow A. Alternate between single and horizontal line breaks, and B. update your resume on job sites once a year, so that you can tell the people who look at the resume what skills you have updated on.
6 0
3 years ago
Other questions:
  • The length of a hailstone sequence is the number of terms it contains. For example, the hailstone sequence in example 1 (5, 16,
    9·1 answer
  • A(n) ____ loop executes a predetermined number of times.
    12·1 answer
  • Software license infringement is also often called software __________.
    11·2 answers
  • The four functions of a computer are
    5·1 answer
  • What part of the computer gives access to the internet
    10·1 answer
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • What do modern CPUs use to simulate the performance of multiple processors within one processor?
    9·2 answers
  • What tool can help discover and report computer errors when you first turn on a computer and before the operating system is laun
    9·2 answers
  • 3) The director tells you to truck left, you must:
    10·1 answer
  • Need Help Please
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!