1.用while方法实现
1
2
3
4
5
6
7
8
9
10
11
|
#!/bin/bash
a=1
sum
=0
while
[ $a -
le
100 ]
do
# ((sum=sum+a))
# ((a++))
let
sum
=
sum
+a
let
a++
done
echo
"$sum"
|
weilovepan520