Skip to content

Commit 1f3dc3a

Browse files
committed
Initial commit
1 parent fedf0ee commit 1f3dc3a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Pattern-1/Character_Pattern.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 N number of rows.
3+
Pattern for N = 4
4+
A
5+
BC
6+
CDE
7+
DEFG
8+
*/
9+
10+
import java.util.*;
11+
12+
public class Character_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+
int m;
23+
char c;
24+
for (int i = 1; i <= N; i++) {
25+
m = 64 + i;
26+
c = (char) m;
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)