1 Star 1 Fork 1

尹经阳/脚本文件

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
nine_n.sh 763 Bytes
一键复制 编辑 原始数据 按行查看 历史
尹经阳 提交于 2023-07-05 19:50 +08:00 . 三种方式九九乘法表
#!/bin/bash
echo -e "\033[36mwhile、for、if混合实现九九乘法表\033[0m"
i=1
while [ $i -lt 10 ]
do
for j in {1..9}
do
if [ $j -le $i ];then
echo -n "$j*$i=$[ $j * $i ] "
fi
done
echo
let i++
done
echo
echo "===========================================================>"
echo
echo -e "\033[36mfor循环实现九九乘法表\033[0m"
for i in {1..9}
do
for j in {1..9}
do
[ $i -ge $j ] && echo -n "$j*$i=$[ $j * $i ] "
done
echo
done
echo
echo "===========================================================>"
echo
echo -e "\033[36mwhile实现九九乘法表\033[0m"
i=1
while [ $i -lt 10 ]
do
j=1
while [ $j -lt 10 ]
do
[ $i -ge $j ] && echo -n "$j*$i=$[ $j * $i ] "
let j++
done
let i++
echo
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/yinjingyang/script-file.git
git@gitee.com:yinjingyang/script-file.git
yinjingyang
script-file
脚本文件
master

搜索帮助