Find the grade of marks in 5 subject of student coderinme

Find the grade of marks in 5 subject of student coderinme

Find the grade of marks in 5 subject of student coderinme
We all better know the range of divisions before we code for it.
First division: 60 and above 60 percent
Second Division: from 50 to 59
Third Division: from 40 to 49
Fail: less than 40 percent are considered to be fail.
It’s also a linux based question.

#!/bin/bash
(bash copy)
sum=0
for i in {1..5}
do
read -p "Enter the number in Subject $i: " temp
sum=`expr $sum + $temp`
done
per=$((sum / 5))
if [[ $per -ge "60" ]]; then
str="First Division"
elif [[ $per -ge "50" && $per -le "59" ]]; then
str="Second Division"
elif [[ $per -ge "40" && $per -le "49" ]]; then
str="Third Division"
else
str="Fail"
fi
echo $str

For more linux shell question
Gross Salary
Listing Shell

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator” to the admin @coderinme

Leave a reply:

Your email address will not be published.