public class test22 {
public static void main(String[] args) {
int n=-1;
for (int i=1;i<8;i++) {
if (n<=5&i<5) {
n+=2;
}else {
n-=2;
}
int x=1,f=1;
int c=(7-n)/2;
while (x<=c) {
System.out.print(" ");
x++;
}
while (f<=n) {
System.out.print("*");
f++;
}
System.out.println(" ");
}
}
JAVA打印一个钻型图案
最新推荐文章于 2022-04-03 16:26:59 发布