-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatriz.java
More file actions
33 lines (31 loc) · 1.21 KB
/
Copy pathmatriz.java
File metadata and controls
33 lines (31 loc) · 1.21 KB
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
import java.util.Scanner;
public class matriz {
public static void main(String[] args) {
int students;
System.out.println("Enter the number of how many students:");
students = new Scanner(System.in).nextInt();
int studentsGrade;
System.out.println("Enter the number of how many grade:");
studentsGrade = new Scanner(System.in).nextInt();
int[][] numbers = new int[students][studentsGrade];
int grade, sum = 0;
String name = "";
for(int i = 0; i < students; i++) {
System.out.println("Enter a Student Name");
name = new Scanner(System.in).nextLine();
for(int j = 0; j < studentsGrade; j++) {
System.out.println("Enter the " + (j+1) + " grade of " + name);
grade = new Scanner(System.in).nextInt();
sum = sum + grade;
numbers[i][j] = sum;
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
System.out.println("The grade of " + (name) + " are " + (sum));
System.out.println(numbers[i][j]);
}
}
System.out.println("End of execution.");
}
}