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

Method pattern6

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

Source from the content-addressed store, hash-verified

12// * *
13// *
14 private static void pattern6(int n) {
15 for (int row = 0; row < 2 * n; row++) {
16 int totalColsInRow = row > n ? 2 * n - row: row;
17
18 int noOfSpaces = n - totalColsInRow;
19 for (int s = 0; s < noOfSpaces; s++) {
20 System.out.print(" ");
21 }
22
23 for (int col = 0; col < totalColsInRow; col++) {
24 System.out.print("* ");
25 }
26 System.out.println();
27 }
28 }
29}

Callers 1

mainMethod · 0.95

Calls 1

printMethod · 0.80

Tested by

no test coverage detected