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

Method pattern8

Programs/patterns/Pattern8.java:12–28  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

10 // 3 2 1 2 3
11 //4 3 2 1 2 3 4
12 static void pattern8(int n) {
13 for (int row = 1; row <= n; row++) {
14
15 for (int space = 0; space < n-row; space++) {
16 System.out.print(" ");
17 }
18
19 for (int col = row; col >= 1; col--) {
20 System.out.print(col + " ");
21 }
22 for (int col = 2; col <= row; col++) {
23 System.out.print(col + " ");
24 }
25
26 System.out.println();
27 }
28 }
29}

Callers 1

mainMethod · 0.95

Calls 1

printMethod · 0.80

Tested by

no test coverage detected