Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 100
- int main ()
- {
- int estaturas[MAX];
- int i=0, alumnos,j;
- float media;
- printf ("Introduzca el numero de alumnos que hay en la clase: ");
- scanf ("%d", &alumnos);
- printf ("La clase consta de %d alumnos",alumnos);
- if (alumnos<2 || alumnos>MAX)
- {
- printf ("Error.\n");
- return -1;
- };
- while (i<alumnos)
- {
- printf ("\nIntroduzca la altura del alumno numero %d en centimetros ",i+1);
- scanf("%d",estaturas[i]);
- i++;
- };
- for (j=0;j<alumnos;j++)
- {
- media= media+estaturas[j];
- };
- media =media/alumnos;
- printf("La media de altura es %f",media);
- return 0;
- }
Add Comment
Please, Sign In to add comment