#!/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刪除。