package com.humi.other;
public class PrintLX {
public static void main(String[] args){
for (int i = 0; i < 5; i++) {//上三角
for (int j = 5-i; j >0; j--) {
System.out.print(" ");
}
for (int j = 0; j <2*i-1; j++) {
System.out.print("*");
}
System.out.println();
}
for (int i = 5; i >0; i--) {//下三角
for (int j = 0; j <5-i; j++) {
System.out.print(" ");
}
for (int j = i; j >-(2*i-1)/2; j--) {
System.out.print("*");
}
System.out.println();
}
}
}
打印菱形
最新推荐文章于 2021-08-29 23:20:12 发布