标签:shell
# 100以内整数和 #!/bin/sh declare -i SUM=0 for ((i=1;i<=100;i+=1)) do let SUM+=$i done echo $SUM #!/bin/sh declare -i SUM=0 for i in {1..100} do let SUM+=$i done echo $SUM #100以内偶数和 #!/bin/sh declare -i SUM=0 for ((i=2;i<=100;i+=2)) do let SUM+=$i done echo $SUM #100以内奇数和 #!/bin/sh declare -i SUM=0 for ((i=1;i<=100;i+=2)) do let SUM+=$i done echo $SUM
本文出自 “技术成就未来” 博客,请务必保留此出处http://jishuweiwang.blog.51cto.com/6977090/1427233
shell使用for循环完成100以内累加,布布扣,bubuko.com
标签:shell
原文地址:http://jishuweiwang.blog.51cto.com/6977090/1427233