Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lp2.lab01;
- import java.util.Scanner;
- /*
- * Laboratório de Programação II - LAB 01
- * @author: Fagner Henrique dos Santos Lima - 117110503
- */
- public class AlunosNotas {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int[] notas = new int[100];
- int menor, maior, acima = 0, abaixo = 0, media = 0, qtd = 0, i;
- while(true) {
- String[] relatorio = input.nextLine().split(" ");
- if (relatorio[0].equals("-")){
- break;
- }
- notas[qtd] = Integer.parseInt(relatorio[1]);
- qtd++;
- }
- menor = notas[0];
- maior = notas[0];
- for (i = 0; i < qtd; i++) {
- media += notas[i];
- if(notas[i] > maior){
- maior = notas[i];
- } else if (notas[i] < menor) {
- menor = notas[i];
- }
- if(notas[i] >= 700){
- acima++;
- } else if (notas[i] < 700) {
- abaixo++;
- }
- }
- media /= qtd;
- System.out.println("maior: " + maior);
- System.out.println("menor: " + menor);
- System.out.println("media: " + media);
- System.out.println("acima: " + acima);
- System.out.println("abaixo: " + abaixo);
- }
- }
Add Comment
Please, Sign In to add comment