Code:
#include <stdio.h>
int main()
{
float array[4][5] =
{{70, 51, 65, 83, 85}, {83, 65, 67, 71, 91},
{90, 70, 71, 77, 80}, {92, 85, 88, 80, 79}};
float rowTotal = 0;
float allRowsTotal = 0;
float maxAverageRowIndx = 0;
float rowCounter = 0;
float columnCounter = 0;
float maxRowAverage = 0;
float rowAverage = 0;
for (rowCounter = 0; rowCounter < 4; rowCounter++)
{
rowTotal = 0;
for (columnCounter = 0; columnCounter < 5; columnCounter++)
{
rowTotal += array[rowCounter][columnCounter];
allRowsTotal += rowTotal;
}
rowAverage = rowTotal / 5;
if (rowAverage > maxRowAverage)
{
maxRowAverage = rowAverage;
maxAverageRowIndx = rowCounter;
}
printf("Row average = %.1f\n", rowAverage);
}
printf("The highest average was found in row %.1f with the value: %.1f\n",
maxAverageRowIndx + 1, maxRowAverage);
return 0;
}