一.计算1到n的和
#!/bin/bash
read -p "input a number " number
sum=0
for i in `seq $number`
do
sum=$((sum+i))
i=$((i+1))
done
echo "1+...+$number:$sum"
一.计算1到n的和
#!/bin/bash
read -p "input a number " number
sum=0
for i in `seq $number`
do
sum=$((sum+i))
i=$((i+1))
done
echo "1+...+$number:$sum"