-
Lenguaje
Java usando Scanner
-
Descripción
Permita leer 5 notas (con calificación de 1 a 100) de 5 estudiantes y obtener el promedio de cada estudiante y en el caso de que el promedio sea menor a 71 mostrar un mensaje de "reprobado".
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
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Scanner;
public class PromedioDe5Estudiantes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, nota_1, nota_2, nota_3, nota_4;
int nota_5, promedio;
for (i=1; i<=5; i++) {
System.out.print("PROCESO " + i);
System.out.print("Ingresa el valor de nota 1: ");
nota_1 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 2: ");
nota_2 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 3: ");
nota_3 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 4: ");
nota_4 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 5: ");
nota_5 = in.nextInt();
in.nextLine();
promedio=(nota_1+nota_2+nota_3+nota_4+nota_5)/5;
if(promedio<71)
System.out.println("reprobado");
System.out.println("Valor de promedio: " + promedio);
System.out.println();
}
}
}
public class PromedioDe5Estudiantes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, nota_1, nota_2, nota_3, nota_4;
int nota_5, promedio;
for (i=1; i<=5; i++) {
System.out.print("PROCESO " + i);
System.out.print("Ingresa el valor de nota 1: ");
nota_1 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 2: ");
nota_2 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 3: ");
nota_3 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 4: ");
nota_4 = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de nota 5: ");
nota_5 = in.nextInt();
in.nextLine();
promedio=(nota_1+nota_2+nota_3+nota_4+nota_5)/5;
if(promedio<71)
System.out.println("reprobado");
System.out.println("Valor de promedio: " + promedio);
System.out.println();
}
}
}