-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPatterns_4.java
More file actions
36 lines (32 loc) · 864 Bytes
/
Patterns_4.java
File metadata and controls
36 lines (32 loc) · 864 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
public class Patterns_4 {
public static void main(String[] args) {
// 11111
// 00000
// 11111
// 00000
// 11111
for(int i = 0; i < 5; i++) {
for(int j = 0 ; j < 5; j++) {
if(i % 2 == 0) {
System.out.print("1");
}
else {
System.out.print("0");
}
}
System.out.println();
}
System.out.println();
for(int i = 0; i < 5; i++) {
for(int j = 0 ; j < 5; j++) {
if(j % 2 == 0) {
System.out.print("1");
}
else {
System.out.print("0");
}
}
System.out.println();
}
}
}