/bin/bash x=0 for i in {1…100} do let x+=i done echo $x 1-100一内所有偶数的和: #!/bin/bash num=0 for i in {1…100} do a=$[i%2] if [a−eq0];thenletnum=a−eq0];thenletnum=num+$i fi done echo $num
while (($i<=100))do sum=$(($sum +$i))i=$(($i+2))done echo $sum
/bin/bash x=0 for i in {1…100} do let x+=i done echo $x 1-100一内所有偶数的和: #!/bin/bash num=0 for i in {1…100} do a=$[i%2] if [a−eq0];thenletnum=a−eq0];thenletnum=num+$i fi done echo $num
计算1-100的和及其1-100内偶数的和(使用shell脚本来实现) 1-100内所有的整数的和: #!/bin/bash x=0 for i in {1..100} do let x+=i done echo $x 1-100一内所有偶数的和:#!/bin/bash num=0 for i in {1..100} do a=[ia -eq 0 ];then let num=num+i fi done echo $num 本文转...