MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / pattern7

Method pattern7

Programs/patterns/Pattern7.java:14–32  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

12 // 2 1 2
13 // 1
14 static void pattern7(int n) {
15 for (int row = 1; row <= 2 * n; row++) {
16
17 int c = row > n ? 2 * n - row: row;
18
19 for (int space = 0; space < n-c; space++) {
20 System.out.print(" ");
21 }
22
23 for (int col = c; col >= 1; col--) {
24 System.out.print(col + " ");
25 }
26 for (int col = 2; col <= c; col++) {
27 System.out.print(col + " ");
28 }
29
30 System.out.println();
31 }
32 }
33}

Callers 1

mainMethod · 0.95

Calls 1

printMethod · 0.80

Tested by

no test coverage detected