Sei sulla pagina 1di 2

Pseudocode StudGrade

This pseudocode will accept the score of 15 students and output who passed, who failed and who
had the highest and lowest grades.

Declare constant passmark as 80.00

Declare variable Hname, Lname as string

Declare variable Passed, Failed, count as integer

Declare variable Lscore, Hscore as real

Declare studname: array [1..15] as string

Declare studscore: array [1..15] as real

BEGIN

Passed = 0

Failed = 0

For (count=1 to 15) Do

BEGIN

PRINT “Enter student name”

Read studname[count]

PRINT “Enter student’s score”

READ studscore [count]

End

Lscore= Studscore [1]

Hscore= Studscore [1]

For (count=1 to 15) Do

If (Lscore>studscore[count]) THEN

Lscore=studscore[count]

Lname=studname[count]

ENDIF

If (Hscore<studscore[count]) THEN

Hscore=studscore[count]

Hname=studname[count]

ENDIF

ENDFOR
For (count=1 to 15) Do

IF (studscore[count]>=passmark) THEN

Passed = Passed + 1

Else

Failed = Failed + 1

ENDIF

ENDFOR

PRINT “The person with the highest grade is”, Hname, “with a grade of”, Hscore

PRINT “The person with the highest grade is”, Lname, “with a grade of”, Lscore

PRINT “The number of students that passed are”, passed, “and the number of students that failed
are”, failed

End

Potrebbero piacerti anche