Shell Script to take Input of 5 Numbers from User and Sum the Even Numbers


Script:

#!/bin/bash
echo "Enter 5 numbers separated by space"
read a b c d e
x=0
for i in $a $b $c $d $e
do
if [ $((i % 2)) -eq 0 ]
then
x=$(( $x + $i ))
fi

done
echo " Sum of even numbers is : $x"






If you like please follow and comment