Answer to Question #277010 in UNIX/Linux Programming for Himanshi

Question #277010

marks obtained by a student in two different subjects are input through the keyboard.


The student gets a division as per the following rules. (Using elif clause).


if percentage greater than or equal to 60 get First division


if percentage greater than or equal to 50 or less than 60 get Second division


if percentage greater than or equal to 40 or less than 50 get Third division


if percentage less than 40 Fail.

1
Expert's answer
2021-12-12T01:17:13-0500

echo "Enter marks of two subjects"

read m1

read m2

per=`echo \($m1 + $m2 \) / 2 | bc`

echo

echo "Percentage is $per"


if [ $per -ge 60]

then

echo "First division"

elif [$per -ge 50 -a $per -lt 60]

then

echo "Second division"

elif [$per -ge 40 -a $per -lt 50]

then

echo "Thid division"

else

echo "Fail"

fi



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS