#!/bin/bashread -p "input the length: " n for i in `seq 1 $n`do for ((j=$n;j>=$i;j--)) do echo -n " " done for((m=1;m<=$i;m++)) do echo -n "* " done echo done for i in `seq 1 $n`do…
打印菱形图案: 代码实现: public class Hello { public static void main(String args[]) { LingXingPrint("#", 7); } public static void LingXingPrint(String i, int num) { /** * 打印菱形,传参:i 为打印的字符,num为行数 . * 思路:将菱形分为上三角和下三角,上三角:每一行空格打印数为总行数-行号:每一行字符打印个数为2*行号-1;下三角…
#输入菱形最宽的行所在的行数,打印菱形 m = int(input(">>>")) for n in range(m): print(" "*(m-n)+"*"*(1+2*n)+" "*(m-n)) #打印菱形 line = int(input(">>>")) for i in range(-line//2,line//2+1): if i < 0: print (…