A
BBB
CCCCC
DDDDDDD
EEEEEEEEE
FFFFFFFFFFF
GGGGGGGGGGGGG
public static void main(String[] args) {
char[] sj = {'A','B','C','D','E','F','G'};
//打印的行数
for (int i = 0; i < sj.length; i++) {
//打印每行的空格数量
for (int j = i; j < sj.length - 1; j++) {
System.out.print(" ");
}
//打印每行的字母数量
for (int j = 0; j <= i * 2;j++) {
System.out.print(sj);
}
System.out.println();
}
} |
|