Custom Search

Saturday, 21 April 2012

Write a Linux shell script for generating mark sheet & calculate grade also, Linux program to find total, average, percentage & Grade for given subjects


Write a Linux shell script for generating mark sheet & calculate grade also, Linux program to find total, average, percentage & Grade for given subjects


Program
clear
echo"Enter no of students:"
read ns


for((i=1;i<ns;i++))
do
echo""""
echo"Enter roll no of student$i:"
read s1[i]


echo "Enter subject1 marks:"
reads1[i]


echo "Enter subject2 marks:"
reads2[i]


echo "Enter subject3 marks:"
reads3[i]


done


for((i=1;i<ns;i++))
do


 total[i]='expr${s1[i]}+${s2[i]}+${s3[i]}
 avg[i]='expr${total[i]}/3'


 if[$avg[i]-ge70]
then 
  grd[i]="DISTINCTION"


  elif[$avg[i]=ge60-a$avg[i]-le69]
then
  grd[i]="SECONDCLASS"


elif[$avg[i]=ge40-a$avg[i]-le49]
then


 grd[i]="PASSCLASS"


else
  grd[i]="FAIL"
fi


done


for((i=1;i,=ns;i++))
do
echo""
echo"______________________________"
echo"Roll no:"${rn[i]}
echo"______________________________"
echo" Subject 1     "${s1[i]}
echo" Subject 2     "${s2[i]}
echo" Subject 3     "${s3[i]}
echo"______________________________"
echo"Total         "${total[i]}
echo"______________________________"
echo" Percentage:  "${avg[i]}
echo"______________________________"
echo" Grade:       "${grd[i]}
echo"______________________________"
echo""
done


Output:
Enter no of student:1
Enter roll no for student:21
Enter marks for subject1:90
Enter marks for subject2:91
Enter marks for subject3:92


_____________________________________
Roll no:21
_____________________________________
Subject 1      90
Subject 2      91
Subject 3      92
_____________________________________
Total          276
_____________________________________
Percentage:    91
_____________________________________
Grade          Distinction
_____________________________________
<<< Previous  ||  Current  ||  Next >>>  

No comments:

Post a Comment

Laptops