Monday 9 July 2012

Result Display

Script-1

    Write a shell script to accept marks for all the subjects of sybca and display the Marks sheet of the student,including the total, average and class.
    -if average is 60 or above then display "first class".
    -if average is 50 or less than 60 then display "second class".
    -if average is 40 or less than 50 then display "third class".
    -otherwise display "fail".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
echo "Enter Marks obtained in DFS: "
read m1
echo "Enter marks obtained in OOP: "
read m2
echo "Enter marks obtained in OS: "
read m3
echo "Enter marks obtained in VB.NET: "
read m4
echo "Enter marks obtained in COAMP: "
read m5
echo "Enter marks obtained in MFCS: "
read m6
echo "Enter marks obtained in SSC: "
read m7
echo "Enter marks obtained in SAD: "
read m8

total=`expr $m1 + $m2 + $m3 + $m4 + $m5 + $m6 + $m7 + $m8`
avg=`expr $total / 8`
echo "Total: $total"
echo "Average: $avg"

if [ $avg -ge 60 ]
then
echo "First Class"
elif [ $avg -ge 50 ]
then
echo "Second Class"
elif [ $avg -ge 40 ]
then
echo "Third Class"
else
echo "Fail"
fi
--------------------------------------------------------------------------------------------------------------
                OUTPUT
Enter Marks obtained in DFS:
78
Enter marks obtained in OOP:
65
Enter marks obtained in OS:
12
Enter marks obtained in VB.NET:
45
Enter marks obtained in COAMP:
78
Enter marks obtained in MFCS:
65
Enter marks obtained in SSC:
25
Enter marks obtained in SAD:
65

Total: 433
Average: 54
Second Class

0 comments:

Post a Comment