shell script to calculate odd numbers between 1 and 100 and the even and

Calculation between 1 and 100 and the odd and the even and

 #!/bin/bash
Evensum=0
ODDsum=0
for  i in {1..100};do
        if [ $(( i%2 )) -eq  0 ];then
                 let Evensum+=$i
        else
                let ODDsum+=$i
        fi  
done
echo "Evensum is $Evensum"
echo "ODDsum is $ODDsum"
~                                   

Guess you like

Origin blog.51cto.com/11342825/2424995