fork(1) download
  1. import java.util.Scanner;
  2.  
  3. class Exer4 {
  4. public static void main(String[] args) {
  5. Scanner in = new Scanner (System.in);
  6. int alunos = in.nextInt();
  7. int notas[] = new int[alunos];
  8. int soma = 0;
  9. for (int i = 0; i < alunos; i++) {
  10. notas[i] = in.nextInt();
  11. soma += notas[i];
  12. }
  13. System.out.println(soma / alunos);
  14. }
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/411367/101
Success #stdin #stdout 0.1s 35108KB
stdin
5
1
2
3
4
5
stdout
3