![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
johnny—we
这个作者很懒,什么都没留下…
展开
-
shell编程基础:多重循环实例
键盘输入:10 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 3 4 5 6 7 8 4 5 6 7 5 6 #!/bin/bash read n for((a=1;a<=n;a++)) do c=n-a+1 for((b=a;b<=c;b++)) do echo -n $b " " done ech...原创 2018-09-04 16:39:46 · 1147 阅读 · 0 评论 -
shell编程斐波那契函数
输入数字得到对应的斐波那契数列 例如: 10 1 1 2 3 5 8 13 21 34 55 echo -n "please enter your want number:" read n first=0 second=0 third=0 for((I=1;i<=n;i++)) do echo -n $third " " let first=$s...原创 2018-09-05 13:45:16 · 1802 阅读 · 3 评论 -
shell编程判断100以内所有素数(质数)
echo -n "please enter number:" read n declare -I a for((i=1;i<=n;i++)) do for((x=1;x<=i;x++)) do b=$(( $i%$x )) if [[ $b -eq 0 ]]; then a=$a+1 fi done if [[ $a -...原创 2018-09-05 14:50:12 · 16707 阅读 · 2 评论