-
Lenguaje
Java usando Scanner
-
Descripción
Sean N estudiantes. Lea las cuatro notas de cada estudiante e imprima la nota definitiva de cada uno, sabiendo que la nota definitiva es igual a la suma de cuatro notas multiplicada por cien, divididas entre 4 y al resultado se le suma uno.
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
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
import java.util.Scanner;
public class NotaDefinitivaDeNEstudiantes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, n;
double nota_1, nota_2, nota_3, nota_4, nota_definitiva;
System.out.print("Ingresa el valor de n: ");
n = in.nextInt();
in.nextLine();
for (i=1; i<=n; i++) {
System.out.print("PROCESO " + i);
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();
System.out.print("Ingresa el valor de nota 4: ");
nota_4 = in.nextDouble();
in.nextLine();
nota_definitiva=(nota_1+nota_2+nota_3+nota_4)*100/4+1;
System.out.println("Valor de nota definitiva: " + nota_definitiva);
System.out.println();
}
}
}
public class NotaDefinitivaDeNEstudiantes {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i, n;
double nota_1, nota_2, nota_3, nota_4, nota_definitiva;
System.out.print("Ingresa el valor de n: ");
n = in.nextInt();
in.nextLine();
for (i=1; i<=n; i++) {
System.out.print("PROCESO " + i);
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();
System.out.print("Ingresa el valor de nota 4: ");
nota_4 = in.nextDouble();
in.nextLine();
nota_definitiva=(nota_1+nota_2+nota_3+nota_4)*100/4+1;
System.out.println("Valor de nota definitiva: " + nota_definitiva);
System.out.println();
}
}
}