Header Ads Widget

Ticker

6/recent/ticker-posts

Write a shell script to generate marksheet of a student. Take 3 subjects, calculate and display total marks, percentage and Class obtained by the student

 echo "Enter marks(out of 30) of "

read -p "Subject 1: " s1
read -p "Subject 2: " s2
read -p "Subject 3: " s3
sum=`expr $s1 + $s2 + $s3`
echo "Sum of marks of 3 subjects is : "$sum
per=`expr $sum \* 10 / 9`
echo "Percentage: "$per
if [ $per -ge 60 ]
then
        echo "you got Distinction"
elif [ $per -ge 50 ]
then
        echo "you got First class"
elif [ $per -ge 40 ]
then
        echo "You got second class"
else
        echo "sorry you failed! better luck next time"
fi

Post a Comment

0 Comments