打印 X 图形

public static void printX(int m) {
for (int x = 1; x <= m; x++) {
for (int y = 1; y <= m; y++) {
if (x == y || x + y == m + 1) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
}
public static void main(String[] args) {
printX(10);
}

原文地址:https://www.cnblogs.com/LinYanyan1024-6285/p/14242639.html