There was an error while loading. Please reload this page.
2 parents 67a2cc0 + 268a948 commit 3e3d5ebCopy full SHA for 3e3d5eb
Pyramid.java
@@ -0,0 +1,43 @@
1
+public class JigSawAcademy
2
+
3
+{
4
5
+ public static void PyramidPattern(int n)
6
7
+ {
8
9
+ for (int i=0; i<n; i++) // for number of rows(n)
10
11
+{ for (int j=n-i; j>1; j–) // a loop for spaces
12
13
14
15
+ System.out.print(” “); //to print space
16
17
+ }
18
19
+ for (int j=0; j<=i; j++ ) //for number of columns
20
21
22
23
+ System.out.print(“* “); //to print star
24
25
26
27
+ System.out.println(); //end-line after every row
28
29
30
31
32
33
+ public static void main(String args[]) //driver function,
34
35
36
37
+ int n = 5;
38
39
+ PyramidPattern(n);
40
41
42
43
+}
0 commit comments