编程题

import java.util.*;
class Demo7 
{
public static void main(String[] args) 
{
System.out.println("请输入1~9之间的数");
Scanner input = new Scanner(System.in);
int a = input.nextInt();
for (int i = 1;i < (a + 1); i++)
{
for (int j = 1 ; j < (a + 1)- i; j++ )
{
System.out.print("  ");
}
for (int k = 1 ;  k <= i ;k++ )
{
System.out.print((char)(k + 64) + " ");
}
for (int g = 1 ; g < i ; g++ )
{
System.out.print((char)(i - g + 64) + " ");
}
System.out.println();
System.out.println();
}
}
}

你可能感兴趣的:(编程题)