fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. double notas[10];
  5. for (int i = 0; i < 10; i++) {
  6. printf("Digite %d: ", i);
  7. scanf("%lf", &notas[i]);
  8. }
  9. int j = 0, count = 0;
  10. double soma = 0;
  11. for (int i = 0; i < 10; i++) {
  12. if (notas[i] > 5) {
  13. soma = soma + notas[i];
  14. count++;
  15. }
  16. }
  17. double media = soma / count;
  18. int P[10];
  19. for (int i = 0; i < 10; i++) {
  20. if (notas[i] >= media) {
  21. P[j] = i;
  22. j++;
  23. }
  24. }
  25. printf("%.2lf\n", media);
  26. for (int i = 0; i < j; i++) {
  27. printf("%d ", P[i]);
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 2172KB
stdin
8.5
5
10
8
3.5
7
9
4
2
9
stdout
Digite 0: Digite 1: Digite 2: Digite 3: Digite 4: Digite 5: Digite 6: Digite 7: Digite 8: Digite 9: 8.58
2  6  9