How to make an algorithm in Java that reads 3 numbers and gives the mean? I know how to do without using repeat structure, but how to do with repeat structure?
Here is my code below, but it does not have the expected result:
public class NotaAluno {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int notaAluno[] = new int[3];
int i;
double media = 0;
for(i = 0; i < notaAluno.length; i++){
System.out.println("Informe o numero da nota do aluno [" + notaAluno[i]+"]" );
notaAluno[i] = entrada.nextInt();
media = (notaAluno.length)/ 3;
}
System.out.println("A Media dos alunos eh " + media);
}
}