noob here.Why is it I get big number for the three %2.1fmm instead of my expected 51.4mm etc..?
Code:
double rainTotal(double rainfall[12])
{
int i;
double total = rainfall[0];
for (i = 1 ; i < 12 ; i++)
{
total += rainfall[i];
return total;
}
}
double lowestMonth(double rainfall[1])
{
return rainfall[1];
}
double highestMonth(double rainfall[9])
{
return rainfall[9];
}
...
int main()
{
double rainfall[12] = {'48.5' , '47.2' , '52.4' , '58.7' , '57.6' , '50.1' , '47.6' , '50.3' , '59.4' , '67.1' , '60.0' , '58.9'};
.......
printf("The average monthly rainfall in Melbourne is %2.1fmm,\n" , total);
printf("The lowest rainfall of %2.1fmm falls in %s,\n" , lowest , month[1]);
printf("The highest rainfall of %2.1fmm falls in %s,\n" , highest , month[9]);
}