• Lenguaje

    Java usando Scanner

  • Descripción

    Leer 3 notas y calcular el promedio, además enviar mensaje si aprobó o no. La nota de aprobación es 7.0

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

public class PromedioDe3Notas {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double nota_1, nota_2, nota_3, 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();
        System.out.print("Ingresa el valor de nota 3: ");
        nota_3 = in.nextDouble();
        in.nextLine();
        promedio=(nota_1+nota_2+nota_3)/3;
        if(promedio<7)
            System.out.println("Reporbado");
        else
            System.out.println("Aprobado");
        System.out.println("Valor de promedio: " + promedio);
    }

}