![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
johnny—we
这个作者很懒,什么都没留下…
展开
-
shell编程基础:多重循环实例
键盘输入:101 2 3 4 5 6 7 8 9 102 3 4 5 6 7 8 93 4 5 6 7 84 5 6 75 6#!/bin/bashread nfor((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编程斐波那契函数
输入数字得到对应的斐波那契数列例如:101 1 2 3 5 8 13 21 34 55echo -n "please enter your want number:"read nfirst=0second=0third=0for((I=1;i<=n;i++))do echo -n $third " " let first=$s...原创 2018-09-05 13:45:16 · 1803 阅读 · 3 评论 -
shell编程判断100以内所有素数(质数)
echo -n "please enter number:"read ndeclare -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 · 16724 阅读 · 2 评论