Last active
January 23, 2024 23:26
-
-
Save LucasHayashi/b02ea1ee0045925353dd49c321e4773b to your computer and use it in GitHub Desktop.
Calcular Média dos 50 Alunos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Media { | |
public static void main(String args[]) { | |
int i = 0, soma = 0; | |
float media = 0; | |
int notas[] = new int[50]; | |
Scanner entrada = new Scanner(System.in); | |
for ( i = 0 ; i < notas.length ; i++ ) { | |
System.out.println("Digite a nota do aluno " + (i+1) + ":"); | |
int nota = entrada.nextInt(); | |
notas[i] = nota; | |
soma+=nota; | |
} | |
media = soma / notas.length; | |
System.out.println("A media das " + notas.length + " notas digitadas e: " + media); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para testar com uma quantidade diferente de médias, basta trocar o tamanho do vetor notas[]