#!/bin/bash
i=1
sum=0
while [ $i -le100 ]
do
sum=`expr $i + $sum`
let i++
done
echo 1 and 100 equal $sum
#################################
#!/bin/bash
sum=0
for i in `seq 1 100`
do
sum=`expr $i + $sum`
done
echo 1 and 100 equal $sum
#!/bin/sh
SUM=0
TMP=1
while [ $TMP -lt 100 ]
do
SUM=`expr $TMP + $SUM`
TMP=`expr $TMP + 1`
done
echo "$SUM"
#! /bin/bash
sum=0
for num in {1..100}
do
((sum=$sum+$num))
done
echo "Total= $sum"
dawdwd ad