public class play4 { public static void main(String[] args) { int n = 4; for (int i = 1; i < n; i++) { System.out.println(); for (int j = 1; j < 9 - i * 2; j++) { System.out.print(" "); } for (int j = 1; j < n + i * 4; j++) { System.out.print("*"); } for (int j = 1; j < 18 - i * 4; j++) { System.out.print(" "); } for (int j = 1; j < n + i * 4; j++) { System.out.print("*"); } for (int j = 1; j < 9 - i * 2; j++) { System.out.print(" "); } } System.out.println(); //上面部分 for (int i = 0; i < 39; i++) { System.out.print("*"); } System.out.println(); for (int i = 0; i < 39; i++) { System.out.print("*"); } // 中间部分 for (int i = 0; i < 7; i++) { System.out.println(); for (int j = 0; j < 1 + i * 3; j++) { System.out.print(" "); } for (int j = 0; j < 38 - (1+ i*3)*2+1; j++) { System.out.print("*"); } for (int j = 0; j < 1 + i * 3; j++) { System.out.print(" "); } } } }
java【爱心】
最新推荐文章于 2024-08-30 18:40:43 发布