-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExamSeating.java
More file actions
40 lines (27 loc) · 987 Bytes
/
ExamSeating.java
File metadata and controls
40 lines (27 loc) · 987 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
35
36
37
38
39
40
import java.util.Scanner;
public class ExamSeating {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Exam Seating Arrangement System");
System.out.print("Enter number of rows: ");
int rows = sc.nextInt();
System.out.print("Enter number of columns: ");
int cols = sc.nextInt();
System.out.print("Enter number of students: ");
int students = sc.nextInt();
int seat = 1;
System.out.println("\nSeating Arrangement:\n");
for(int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
if(seat <= students) {
System.out.print("S" + seat + "\t");
seat++;
} else {
System.out.print("Empty\t");
}
}
System.out.println();
}
sc.close();
}
}