Skip to content

Commit be30772

Browse files
committed
Initial commit
1 parent bd752b3 commit be30772

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Print the following pattern for the given N number of rows.
3+
Pattern for N = 4
4+
5+
1
6+
1 2
7+
1 2 3
8+
1 2 3 4
9+
*/
10+
11+
import java.util.*;
12+
13+
public class Mirror_Image_Number_Pattern {
14+
public static void main(String[] args) {
15+
16+
/*
17+
* Your class should be named Solution.
18+
* Read input as specified in the question.
19+
* Print output as specified in the question.
20+
*/
21+
Scanner sc = new Scanner(System.in);
22+
int n = sc.nextInt();
23+
int count = 1;
24+
for (int i = n; i > 0; i--) {
25+
for (int j = 1; j < i; j++)
26+
System.out.print(" ");
27+
for (int j = 1; j <= count; j++) {
28+
System.out.print(j);
29+
}
30+
System.out.println();
31+
count++;
32+
}
33+
34+
}
35+
}

0 commit comments

Comments
 (0)