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.
1 parent 163e178 commit d60f3ceCopy full SHA for d60f3ce
Pattern-1/Triangle_Number_Pattern.java
@@ -0,0 +1,31 @@
1
+/*
2
+Print the following pattern for the given N number of rows.
3
+Pattern for N = 4
4
+1
5
+22
6
+333
7
+4444
8
+*/
9
+
10
+import java.util.*;
11
12
+public class Triangle_Number_Pattern {
13
+ public static void main(String[] args) {
14
15
+ /*
16
+ * Your class should be named Solution.
17
+ * Read input as specified in the question.
18
+ * Print output as specified in the question.
19
+ */
20
+ Scanner sc = new Scanner(System.in);
21
+ int N = sc.nextInt();
22
23
+ for (int i = 0; i <= N; i++) {
24
+ for (int j = 0; j < i; j++) {
25
+ System.out.print(i);
26
+ }
27
+ System.out.println("");
28
29
30
31
+}
0 commit comments