The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:
Percentage above or equal to 60 – First division
Percentage between 50 and 59 – Second Division
Percentage between 40 and 49 – Third Division
Percentage less than 40 – Fail.
Write a program to calculate the division obtained by the student.
echo -n "Enter COA marks :"
read coa
echo -n "Enter DM marks :"
read dm
echo -n "Enter WT marks : "
read wt
echo -n "Enter C marks: "
read c
echo -n "Enter AFM marks : "
read afm
sum=`expr $coa + $dm + $wt + $c + $afm`
avg=`expr $sum / 5`
echo "Average is $avg%"
if [ $avg -ge 60 ]
then
echo "First Division"
elif [ $avg -gt 50 -a $avg -lt 59 ]
then
echo "Second Division"
elif [ $avg -gt 40 -a $avg -lt 49 ]
then
echo "Third Division"
else
echo "FAIL"
fi