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 be30772 commit f0c1a04Copy full SHA for f0c1a04
Pattern-2/Inverted_Number_Pattern.java
@@ -0,0 +1,30 @@
1
+/*
2
+Print the following pattern for the given N number of rows.
3
+Pattern for N = 4
4
+4444
5
+333
6
+22
7
+1
8
+*/
9
+
10
+import java.util.Scanner;
11
12
+public class Inverted_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
+ for (int i = n; i >= 1; i--) {
23
+ for (int j = 1; j <= i; j++) {
24
+ System.out.print(i);
25
+ }
26
+ System.out.println();
27
28
29
30
+}
0 commit comments