#include <conio.h>
#include <stdio.h>
/*******************************************************************************
* Esta función calcula la media de los minutos jugados de todos los
* jugadores por partido.
******************************************************************************/
float media(float tiempoJugado[12][10]){
float media;
float suma;
int i;
int j;
for(i=0; i<12; i++){
for(j=0; j<10; j++){
suma=suma+tiempoJugado[i][j];
}
}
return suma /(12*10);
}
int main(int argc, char *argv[]){
clrscr();
float tiempoJugado[12][10] =
{
{5.55, 16.8, 17.8, 7.95, 23.8, 19.6, 3.83, 24.9, 5.31, 37.4},
{4.45, 23.1, 7.59, 38.0, 8.37, 24.1, 2.35, 20.5, 15.6, 27.2},
{7.64, 6.31, 14.6, 14.7, 16.8, 6.50, 13.0, 14.8, 38.8, 20.7},
{7.12, 13.9, 16.1, 19.7, 16.9, 2.13, 6.61, 27.0, 27.6, 8.90},
{38.9, 1.86, 22.9, 0.491, 20.7, 27.2, 6.31, 20.1, 32.1, 15.5},
{17.5, 39.6, 32.8, 3.10, 21.6, 5.21, 29.9, 3.20, 31.7, 37.9},
{29.1, 22.5, 13.4, 17.7, 23.0, 13.4, 5.37, 37.9, 37.8, 30.6},
{1.42, 20.1, 22.1, 28.9, 28.6, 15.0, 34.8, 28.5, 39.8, 37.7},
{31.5, 1.28, 7.30, 31.0, 35.7, 1.51, 28.5, 24.1, 5.90, 37.5},
{19.7, 35.2, 29.2, 6.96, 20.6, 22.0, 8.83, 19.4, 6.20, 13.9},
{32.2, 13.0, 15.5, 22.3, 15.3, 38.0, 9.63, 33.3, 21.5, 36.3},
{17.7, 29.5, 4.04, 18.2, 17.8, 1.16, 10.7, 39.4, 0.613, 30.5}
};
int c;
printf("\nEscoja la opcion que desea:");
printf("\n a - La media de tiempo jugado del equipo.");
printf("\n\nESCRIBA SU SELECCION , Y LUEGO <<ENTER>> : ");
c = getchar();
switch(c) {
case 'a':
printf("\nLa media de tiempo jugado del equipo es: %f\n\n",media(tiempoJugado));
break;
}
getch();;
return 0;
}