这道题目怎么做啊???急 Java编程:使用循环语句输出如下图案(菱形) * *** ***** ******* ***** ***

如题所述

第1个回答  2017-04-24
public static void main(String[] args) {
rhombus(10);
}

public static void rhombus(int length) {
for (int i = 0; i <= length * 2; i++) {
blank(Math.abs(i - length));
star(i > length ? (length*2 - i) * 2 + 1 : i * 2 + 1);
}
}

public static void blank(int length) {
for (int i = 0; i < length; i++) {
System.out.print(" ");
}
}

public static void star(int length) {
for (int i = 0; i < length; i++) {
System.out.print("*");
}
System.out.println();
}
纯手工写的.本回答被网友采纳
相似回答