Advertisement
weldisalves

Lista 04 - exercício 01

Jun 18th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #define MAX 10
  3.  
  4. /* 1. Leia um conjunto de 10 notas de alunos. Calcule
  5. e exiba a média destas notas. Em seguida exiba apenas
  6. as notas que são maiores do que a média calculada. */
  7.  
  8. int main()
  9. {
  10.     int i;
  11.     float notas[MAX],media,soma=0;
  12.  
  13.     for(i=0;i<MAX;i++)
  14.     {
  15.         printf("\n Digite a %d nota: ",i+1);
  16.         scanf("%f",&notas[i]);
  17.  
  18.         soma += notas[i];
  19.     }
  20.     media = soma/MAX;
  21.     printf("\n Notas maiores media: ");
  22.     for(i=0;i<MAX;i++)
  23.     {
  24.         if(notas[i] > media)
  25.         {
  26.             printf("\n Nota: %.2f",notas[i]);
  27.         }
  28.     }
  29.     getch();
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement