- public class Demo {
- public static void main(String[] args) {
- for (int i = 0; i < 5; i++) {
- for (int j = 0; j < 9; j++) {
- if(j<4-i||j>4+i){
- System.out.print(" ");
- }else{
- System.out.print("*");
- }
- }
- System.out.println();
- }
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < 9; j++) {
- if(j<i+1||j>7-i){
- System.out.print(" ");
- }else{
- System.out.print("*");
- }
- }
- System.out.println();
- }
- }
- }
复制代码
*
***
*****
*******
*********
*******
*****
***
*
暂时只打出了个这个,等再给你看看,怎么修改一下 |