We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fcd4fe6 commit 60c7a2fCopy full SHA for 60c7a2f
InterviewPrograms/src/com/java/patterns/Pattern44.java
@@ -0,0 +1,37 @@
1
+package com.java.patterns;
2
+import java.util.Scanner;
3
+/*
4
+Write the program to print the following pattern
5
+A
6
+A B
7
+A B C
8
+A B C D
9
+A B C D E
10
+*/
11
+public class Pattern44 {
12
+ public static void main(String args[] ) throws Exception {
13
+ Scanner scanner = new Scanner(System.in);
14
+ int N = Integer.parseInt(scanner.nextLine());
15
+ String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
16
+ for(int i=0;i<N;i++){
17
+ for(int j=0;j<=i;j++)
18
+ if(j == 0)
19
+ System.out.print(s.charAt(j));
20
+ else
21
+ System.out.print(" "+s.charAt(j));
22
+ if(i != N-1)
23
+ System.out.println();
24
+ }
25
+ scanner.close();
26
27
+}
28
29
+Input
30
+5
31
+Output
32
33
34
35
36
37
0 commit comments