Skip to content

Commit e70e6be

Browse files
committed
Initial commit
1 parent d60f3ce commit e70e6be

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Pattern-1/Reverse_Number_Pattern.java

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

0 commit comments

Comments
 (0)