-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path2M_NotasPromedios.java
More file actions
34 lines (28 loc) · 854 Bytes
/
2M_NotasPromedios.java
File metadata and controls
34 lines (28 loc) · 854 Bytes
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
import java.util.Scanner;
public class NotasPromedios {
/*
Solicitar tres notas de alumnos y calcular el promedio, almacenar en la matriz
*/
public static void main (String[] args) {
float notasPromedios[][] = new float [10][4];
Scanner teclado = new Scanner (System.in);
for (int f = 0; f < 10; f++) {
float suma = 0;
float prom = 0;
for (int c = 0; c < 4; c++) {
if (c < 3) {
System.out.print("Ingrese una nota: ");
int entrada = teclado.nextInt();
notasPromedios[f][c] = entrada;
suma = suma + entrada;
} else {
prom = suma / 3;
notasPromedios[f][c] = prom;
}
}
}
for (int f = 0; f < 2; f++) {
System.out.println("Las notas son: " + notasPromedios[f][0] + " " + notasPromedios[f][1] + " " + notasPromedios[f][2] + " y su promedio: " + notasPromedios[f][3]);
}
}
}