# Write a script to print the marks of 5 subjects
# then calculator Sum and average. Hint (m1+m2+m3+m4+m5)/5
if [[ "$#" -ne "5" ]]; then
echo "Usage: $0 mark1 mark2 mark3 mark4 mark5"
exit 1
fi
sum=0
for x in $@; do
sum=$(($sum+$x))
done
echo "Sum: $sum"
echo "Avg: " $(($sum/5))
Comments
Leave a comment