Skip to content

Commit fedf0ee

Browse files
committed
Initial commit
1 parent e70e6be commit fedf0ee

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Pattern-1/Interesting_Alphabets.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Print the following pattern for the given number of rows.
3+
Pattern for N = 5
4+
E
5+
DE
6+
CDE
7+
BCDE
8+
ABCDE
9+
*/
10+
11+
import java.util.*;
12+
13+
public class Interesting_Alphabets {
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 m;
24+
char c = (char) (65 + N);
25+
for (int i = 1; i <= N; i++) {
26+
c = (char) (c - i);
27+
for (int j = 0; j < i; j++) {
28+
System.out.print(c);
29+
c++;
30+
}
31+
System.out.println("");
32+
}
33+
34+
}
35+
}

0 commit comments

Comments
 (0)