We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
soma_vetor.java
Não precisa de 3 For para fazer esse exercício segue minha sugestão menor
public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in);
System.out.printf("Quantos numeros voce vai digitar? "); int n = sc.nextInt(); double[] vetor = new double[n]; for (int i=0; i<n; i++) { System.out.printf("Digite um numero: "); vetor[i] = sc.nextDouble(); } double soma=0.0; System.out.printf("%nVALORES = "); for(int i=0; i<n; i++) { System.out.printf(" " + vetor[i]); soma += vetor[i]; } System.out.println("\nSOMA = " + soma); double media = soma / n; System.out.println("MEDIA = " + media); sc.close(); }
The text was updated successfully, but these errors were encountered:
Muito bom.
Sorry, something went wrong.
No branches or pull requests
soma_vetor.java
Não precisa de 3 For para fazer esse exercício segue minha sugestão menor
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
The text was updated successfully, but these errors were encountered: