-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern17.java
More file actions
35 lines (30 loc) · 770 Bytes
/
pattern17.java
File metadata and controls
35 lines (30 loc) · 770 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
32
33
34
35
public class Solution {
public static void alphaHill(int n) {
// Write your code here
for(int i=1;i<=n;i++){
//space
for(int j=0;j<n-i;j++){
System.out.print(" ");
}
char ch='A';
int breakpoint=(2*i)/2;
for(int j=1;j<2*i;j++){
System.out.print(ch+" ");
if(j<breakpoint){
ch++;
}
else{
ch--;
}
}
//space
for(int j=0;j<n-i;j++){
System.out.print(" ");
}
System.out.println(" ");
}
}
}
A
A B A
A B C B A