Monday, October 7, 2013

ALGORITHM FOR GIVEN PROBLEM- STUDENT TAKES AN ENTRANCE TEST CONSISTING OF FOUR SUBJECTS. THE PERCENTAGE IS TO BE CALCULATED. THE MAXIMUM MARKS PER SUBJECT IS HUNDRED. IF THE PERCENTAGE IS MORE THAN 80 THE STUDENT IS GRADED AS EXCELLENT. IF THE PERCENTAGE IS MORE THAN 70 THE STUDENT IS GRADED AS DISTINCTION. AND FOR MORE THAN 60 STUDENT IS GRADED AS ELIGIBLE. FOR ANY OTHER PERCENTAGE HE IS GRADED AS INELIGIBLE. (IS ELSE-IF ELSE STRUCTURE)



STEP 1.    S1 <-- 0, S2 <-- 0, S3 <-- 0, S4 <-- 0, Percent <-- 0
STEP 2.    Read S1, S2, S3, S4
STEP 3.    Percent <-- (S1+S2+S3+S4)*100/400
STEP 4.    Is (Percent > 80 and Percent <= 100)    Then
   Begin
         Print “Excellent”
   End
Else if (Percent > 70 and Percent <= 80) Then
   Begin
        Print “Distinction”
   End
Else if (Percent > 60 and Percent <= 70) Then
    Begin
        Print “Eligible
    End
  Else
     Begin
        Print “Ineligible”
     End

No comments:

Post a Comment