Monday 16 January 2012

#program to check whether the student has got 60% marks then print "FIRST", if he/she got less than 60% but greater than 40% then print "SECOND", if he/she got 40% and above but less than 33% then print "THIRD" otherwise "FAIL"


echo 'Enter the marks of student in five subjects '
read a
read b
read c
read d
read e
total=` expr $a + $b + $c + $d + $e `
per=` expr $total / 5 `
echo "He got $total in subtotal marks and $per% marks in five subjects. So his/her division is "
if test $per -ge 60
then
echo "FIRST"
elif test $per -ge 40
then
echo "SECOND"
elif test $per -ge 33
then
echo "THIRD"
else
echo "Fail"
fi

No comments:

Post a Comment