#!/bin/bash echo "Compute the sum of the even number which between 1 and 100..." SUM=0 for i in $(seq 100) do if [ $((i%2)) == 0 ]; then ((SUM+=i)) fi done echo "The result is $SUM"
参照原文:https://blog.csdn.net/muyanmoyang/article/details/48136945
#!/bin/bash echo "Compute the sum of the even number which between 1 and 100..." SUM=0 for i in $(seq 100) do if [ $((i%2)) == 0 ]; then ((SUM+=i)) fi done echo "The result is $SUM"
参照原文:https://blog.csdn.net/muyanmoyang/article/details/48136945
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。