Resposta Java:
import java.util.*;
public class Main {
public static void main(String[] args) {
int soma = 0;
float media = 0;
Scanner scanner = new Scanner(System.in);
Vector<Integer> vetor = new Vector<>();
for (int i = 0; i < 20; i++) {
System.out.println("Digite um numero: ");
int numero = scanner.nextInt();
vetor.add(numero);
}
for (int i = 0; i < vetor.size(); i++){
soma = soma + vetor.get(i);
media = soma / vetor.size();
for (int i = 0; i < vetor.size(); i++) {
if (vetor.get(i) < media) {
System.out.println(vetor.get(i));
Copyright © 2024 ELIBRARY.TIPS - All rights reserved.
Lista de comentários
Resposta Java:
import java.util.*;
public class Main {
public static void main(String[] args) {
int soma = 0;
float media = 0;
Scanner scanner = new Scanner(System.in);
Vector<Integer> vetor = new Vector<>();
for (int i = 0; i < 20; i++) {
System.out.println("Digite um numero: ");
int numero = scanner.nextInt();
vetor.add(numero);
}
for (int i = 0; i < vetor.size(); i++){
soma = soma + vetor.get(i);
}
media = soma / vetor.size();
for (int i = 0; i < vetor.size(); i++) {
if (vetor.get(i) < media) {
System.out.println(vetor.get(i));
}
}
}
}