Uploaded by Brian Harvey Tagustos

Tagustos ASS2

advertisement
Brian Harvey M. Tagustos
202101453
BSCE 2-1
CPEN 21-A
PSEUDOCODE, ALGORITHM, AND FLOWCHART
FOR SELECTION CONTROL STRUCTURE
Write an algorithm and draw the flowchart to determine a student’s final grade and indicate
whether it is passing or failing. The final grade is calculated as the average of four marks.
Pseudocode:
 Read 4 marks
 Calculate their average by adding then dividing by 4
 if average is below 70
Print “FAILED”
else
Print “PASSED”
Algorithm:
 Step 1. Start
 Step 2. Read 4 marks (m1, m2, m3, m4)
 Step 3. Calculate average = (m1+m2+m3+m4)/4
 Step 4. If average is below 70
Print “FAILED”
else
Print “PASSED”
 Step 5. Stop
Flowchart:
Start
Read marks
(m1, m2, m3, m4)
Average =
(m1+m2+m3+m4)/4
Y
If average
<70
Print
“FAILED”
N
Print
“PASSED”
Stop
Download