fork(1) download
  1. #include <stdio.h>
  2. #include <limits.h>
  3. #define NUM 5
  4.  
  5. int main(){
  6. float notas[NUM];
  7. float media = 0;
  8. float maior = 0, menor = INT_MAX;
  9. for (int i = 0; i < NUM; i++) {
  10. scanf("%f", &notas[i]);
  11. maior = notas[i] > maior ? notas[i] : maior;
  12. menor = notas[i] < menor ? notas[i] : menor;
  13. media += notas[i];
  14. }
  15. media /= NUM;
  16. printf("%.1f %.1f %.1f\n\n", maior, menor, media);
  17. for (int i = 0; i < NUM; i++) {
  18. printf("%.1f ", notas[i]);
  19. }
  20. }
Success #stdin #stdout 0s 2164KB
stdin
5
3
7
8
2
stdout
8.0 2.0 5.0

5.0 3.0 7.0 8.0 2.0