import scala.io.StdIn
object Demo9{
def main(args:Array[String]):Unit={
println("输入行数:");
var n:Int=StdIn.readInt();
for (a<- 1 to n by 2){
for(b<- n to a by -2){
print(" ");
}
for(c<- 1 to a){
print("*");
}
println();
}
var y=n-2
for(a<- 1 to y by 2){
print(" ");
for(b<- 1 to a by 2){
print(" ");
}
for(c<- y to a by -1){
print("*");
}
println();
}
}
}
座右铭:站在别人的思想上,看见自己的不足,传播错误的经验,愿君不重蹈覆辙。
由于受限于本人经验,难免不足,如有建议,欢迎留言交流。
说明:如果喜欢,请点赞,您的鼓励是本人前进最好的动力