Skip to content

Commit c3ba10f

Browse files
Merge pull request #219 from Udit1542/patch-1
Hacktoberfest2023
2 parents 84e7c1b + b6b2470 commit c3ba10f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pattern2.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Java Program to print pattern
2+
// Number-increasing pyramid
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 handle number of columns
13+
for (j = 1; j <= i; j++) {
14+
// printing column values upto the row
15+
// value.
16+
System.out.print(j + " ");
17+
}
18+
19+
// print new line for each row
20+
System.out.println();
21+
}
22+
}
23+
24+
// Driver Function
25+
public static void main(String args[])
26+
{
27+
int n = 6;
28+
printPattern(n);
29+
}
30+
}

0 commit comments

Comments
 (0)