Here is my code:
这是我的代码:
public static void drawNumDiamond(int h) {
char c= 'A';
if(h!=0) {
if (h % 2 == 1) {
for (int i = h/2; i >= -(h/2); i--) {
for (int j = 1; j <= Math.abs(i); j++) {
System.out.print("-");
}
for (int j = 0; j <= 2 * ((h/2) - Math.abs(i)); j++) {
System.out.print(c);
}
System.out.println();
if (i > 0) {
c++;
} else {
c--;
}
}
} else {
System.out.println("NO VALID INPUT");
}
}
}
public static voi