Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. float func(int notas[10][3], int i)
  4. {
  5.  
  6. float soma;
  7. int a;
  8. for(a=0; a<3; a++)
  9. {
  10. soma += notas[i][a];
  11. }
  12.  
  13. return soma/3;
  14.  
  15. }
  16.  
  17. int main()
  18. {
  19. char nomes[10][100];
  20. int notas[10][3];
  21. int i, a=0, b = 0, j;
  22. char xxx[100];
  23.  
  24.  
  25. printf("Digite o nome do aluno :\n");
  26. for (i=0; i<5; i++)
  27. {
  28. gets(nomes[i]);
  29. for (j=0; j<3; j++)
  30. {
  31. printf("Digite a %d nota\n", j+1);
  32. scanf("%d",&notas[i][j]);
  33. a = func(notas, i);
  34. if (a > b)
  35. {
  36. b = a;
  37.  
  38. xxx = nomes[i];
  39. }
  40.  
  41. }
  42.  
  43. printf("MAIOR NOTA = %d DO ALUNO %c ", b, xxx);
  44.  
  45.  
  46. }
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement