Finding the month with the highest total rainfall

How do you find the month with the highest total rainfall using stdio.h in c?

1
2
3
4
5
6
7
#include <stdio.h>

January[] = {5.0, 0.3, 0.2, 0.0, 1.2};
February[] = {6.0, 2.3, 0.0, 1.2, 0.5};
March[] = {0.0, 0.0, 0.0, 0.8, 0.5};

............

Given the information above, I know that February has the highest total rainfall. But I do not know what is the code to find it. Can anyone help me? Thanks.

Write a function that will accept an array (if you must use arrays) and the size of the array as arguments to the function and returns the number for the total rainfall for the given array. Then keep track of which array returns the largest number i.e. highest rainfall.
Sorry, but I don't quite get what you are saying. Maybe if you could give me an example so that I can understand better. Thanks!
I know that February has the highest total rainfall.

How do you "know". Describe step by step how you came to this conclusion.

Basically I just add up everything together then compare the three of them to see which is the highest. But I do not know how to put it in code.
What have you tried?

Start with something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main()
{
   
   int January[] = {5.0, 0.3, 0.2, 0.0, 1.2};
   int January_total;

   // Compute Januaries total.

   cout << January_total << endl;

   return 0;
}


Thank you so much! Finally manage to find the highest total rainfall. Thanks!
Topic archived. No new replies allowed.