JAVA课程04
package For语句数字金字塔; public class For语句数字金字塔 { public static void main(String[] args) { // TODO Auto-generated method stub for (int h = 1; h <= 5; h++) { for (int k = 0; k < 5 - h; k++) System.out.print(" "); for (int x = 0; x < h; x++) { System.out.print(x * 2 + 1); } for (int x = h - 1; x > 0; x--) { System.out.print(x * 2 - 1); } System.out.println(); } } }