Skip to content

Commit dd63d47

Browse files
committed
some advanced patterns
1 parent f7f7c19 commit dd63d47

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/binod/Pattern.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ public static void main(String[] args) {
1010
}
1111
}
1212

13+
class Pattern1 {
14+
public static void main(String[] args) {
15+
int n = 5;
16+
for (int line = n; line >= 1; line--) {
17+
for (int number = 1; number <= line; number++) {
18+
System.out.print(number);
19+
}
20+
System.out.println();
21+
}
22+
}
23+
}
24+
1325
class Pattern2 {
1426
public static void main(String[] args) {
1527
for (int line = 0; line < 5; line++) {
@@ -78,3 +90,16 @@ public static void main(String[] args) {
7890
}
7991
}
8092
}
93+
94+
class Pattern8 {
95+
public static void main(String[] args) {
96+
int num = 1;
97+
for (int line = 1; line <= 5; line++) {
98+
for (int number = 1; number <= line; number++) {
99+
System.out.print(num);
100+
num += 1;
101+
}
102+
System.out.println();
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)