• Lenguaje

    Java usando Scanner

  • Descripción

    Permita ingresar dos notas sobre 20 y determine su promedio, debe mostrar un comentario:
    a. Aprobado si la nota está entre 14 y 20.
    b. Reprobado si es menor a 14.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Scanner;

public class NotasSobre20 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double nota_1, nota_2, promedio;
        System.out.print("Ingresa el valor de nota 1: ");
        nota_1 = in.nextDouble();
        in.nextLine();
        System.out.print("Ingresa el valor de nota 2: ");
        nota_2 = in.nextDouble();
        in.nextLine();
        promedio=(nota_1+nota_2)/2;
        if(promedio>=14&&promedio<=20)
            System.out.println("Aprobado");
        if(promedio<14)
            System.out.println("Reprobado");
        System.out.println("Valor de promedio: " + promedio);
    }

}