-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpattern.java
More file actions
28 lines (27 loc) · 779 Bytes
/
pattern.java
File metadata and controls
28 lines (27 loc) · 779 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
import java.util.*;
public class pattern {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int rows = input.nextInt();
int k, l;
String string1="";
String string2="";
for (int i=0;i<rows;i++) {
for (int j=0;j<i;j++)
{
System.out.print(" ");
}
for (k=65;k<rows+65-i;k++)
{
string1=Character.toString(k);
System.out.print(string1+" ");
}
for (l=k-2;l>=65;l--)
{
string2=Character.toString(l);
System.out.print(string2+" ");
}
System.out.println();
}
}
}