SHELL SCRIPT TO PRINT STUDENT MARK LIST | URDINESH

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

Sunday, July 19, 2015

SHELL SCRIPT TO PRINT STUDENT MARK LIST

STUDENT MARK LIST:

echo "Enter the no. of Students"
read n
for(( i=1;i<=n;i++ ))
do
 echo "Enter Name,Mark1 and Mark2"
 read name
 read mark1
 read mark2
 tot=`echo $mark1+$mark2|bc`
 if [ $mark1 -ge 40 -a $mark2 -ge 40 ]
 then
 res="Pass"
 else
 res="Fail"
 fi
avg=`echo $tot/2|bc`
echo "NAME"  $name
echo "MARK1" $mark1
echo "MARK2" $mark2
echo "TOTAL" $tot
echo "Average"  $avg
echo "Result" $res
done






















OUTPUT:
enter the no. of students
2
enter name,mark1 and mark2
geetharani
87
56
name geetharani
mark1 87
mark2 56
total 143
average 71
result pass
enter name,mark1 and mark2
ranjani
78
98
name ranjani
mark1 78
mark2 98
total 176
average 88
result pass

No comments:

Post a Comment

Thanks for your valuable comments

Followers