-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (29 loc) · 759 Bytes
/
Copy pathMain.java
File metadata and controls
31 lines (29 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
char[] arr = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T', 'U','V','W','X','Y','Z'};
Scanner sc = new Scanner(System.in);
char a = sc.next().charAt(0);
a = Character.toUpperCase(a);
int in = 0;
for( int i = 0; i< 26; i++){
if(arr[i] == a){
in = i;
}
}
for( int j = 0; j<=in; j++){
for(int k = j; k<=in; k++){
System.out.print(arr[k] + " ");
}
System.out.println("");
}
for(int l = in-1; l >=0; l--){
for(int m = l; m <= in; m++){
System.out.print(arr[m] + " ");
}
System.out.println("");
}
// System.out.println(in);
}
}