mirror of
https://gitlab.com/blau_araujo/cblc.git
synced 2025-05-10 18:46:36 -03:00
34 lines
570 B
C
34 lines
570 B
C
#include <stdio.h>
|
|
|
|
#define NBIM 4
|
|
|
|
float favg(float *arr, int size) {
|
|
float sum = 0;
|
|
for (int i = 0; i < size; i++) {
|
|
sum += arr[i];
|
|
}
|
|
return sum / size;
|
|
}
|
|
|
|
int main(void) {
|
|
|
|
float notas[NBIM];
|
|
|
|
notas[0] = 7.5;
|
|
notas[1] = 9.0;
|
|
notas[2] = 8.3;
|
|
notas[3] = 8.6;
|
|
|
|
float avg = favg(notas, NBIM);
|
|
|
|
puts("============");
|
|
|
|
for (int i = 0; i < NBIM; i++)
|
|
printf("Bim. %d: %.1f\n", i + 1, notas[i]);
|
|
|
|
puts("------------");
|
|
printf("Média : %.1f\n", avg);
|
|
puts("============");
|
|
|
|
return 0;
|
|
}
|