-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupm4.java
More file actions
36 lines (32 loc) · 1020 Bytes
/
upm4.java
File metadata and controls
36 lines (32 loc) · 1020 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
import java.util.Scanner;
public class upm4 {
public static void main(String [] args) {
Scanner s = new Scanner(System.in);
int baris, kolom;
System.out.print("Input jumlah baris : ");
baris = s.nextInt();
System.out.print("Input jumalh kolom : ");
kolom = s.nextInt();
System.out.println();
for(int i = 1; i <= baris; i++) {
for(int j = 1; j <= kolom; j++) {
if(i % 2 == 0) {
if(j % 2 == 0) {
System.out.print("X ");
}
else {
System.out.print("O ");
}
} else {
if(j % 2 == 0) {
System.out.print("O ");
}
else {
System.out.print("X ");
}
}
}
System.out.println();
}
}
}