We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c066e5e + f15612b commit 3a5a6dbCopy full SHA for 3a5a6db
pattern.java
@@ -0,0 +1,31 @@
1
+// Java Program to print pattern
2
+// Number triangle pattern
3
+import java.util.*;
4
+
5
+public class GeeksForGeeks {
6
+ // Function to demonstrate pattern
7
+ public static void printPattern(int n)
8
+ {
9
+ int i, j;
10
+ // outer loop to handle number of rows
11
+ for (i = 1; i <= n; i++) {
12
+ // inner loop to print space
13
+ for (j = 1; j <= n - i; j++) {
14
+ System.out.print(" ");
15
+ }
16
+ // inner loop to print star
17
+ for (j = 1; j <= i; j++) {
18
+ System.out.print(i + " ");
19
20
+ // print new line for each row
21
+ System.out.println();
22
23
24
25
+ // Driver Function
26
+ public static void main(String args[])
27
28
+ int n = 6;
29
+ printPattern(n);
30
31
+}
0 commit comments