1.shell语法
#!/bin/bash
for i in $(seq 9)
do
for j in $(seq $i)
do
echo -n "$i*$j=$(($i*$j)) "
done
echo ""
done
2.C语法
for ((i=1;i<=9;i++))
do
for ((j=1;j<=i;j++))
do
echo -n "$j*$i=$[$i*$j] "
done
echo ""
done
结果:
1.shell语法
#!/bin/bash
for i in $(seq 9)
do
for j in $(seq $i)
do
echo -n "$i*$j=$(($i*$j)) "
done
echo ""
done
2.C语法
for ((i=1;i<=9;i++))
do
for ((j=1;j<=i;j++))
do
echo -n "$j*$i=$[$i*$j] "
done
echo ""
done
结果: