-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern14.java
More file actions
54 lines (45 loc) · 831 Bytes
/
Copy pathpattern14.java
File metadata and controls
54 lines (45 loc) · 831 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
1
212
32123
4321234
543212345
4321234
32123
212
1
*/
package Patterns;
import java.util.Scanner;
public class pattern14 {
public static void main(String[] args) {
int n;
Scanner k = new Scanner(System.in);
System.out.println("How Many Rows you want?");
n = k.nextInt();
for (int i = 1; i <= n; i++) {
for (int x = n; x > i; x--) {
System.out.print(" ");
}
for (int j = i; j >= 1; j--) {
System.out.print(j);
}
for (int y = 2; y <= i; y++) {
System.out.print(y);
}
System.out.println();
}
for (int i = n - 1; i >= 1; i--) {
for (int x = n; x > i; x--) {
System.out.print(" ");
}
for (int j = i; j >= 1; j--) {
System.out.print(j);
}
for (int x = 2; x <= i; x++) {
System.out.print(x);
}
System.out.println();
}
}
}