Rayad S.
Ali
4.2 IT
Problem #5
Write a program that accepts a student’s mark. If the mark is greater
than or equal to 50 the student passes and fails if their mark is less
than 50. This program must print if the student passed or failed.
I.P.O Chart.
Input Processing Output
A Student’s mark (1). Read a student’s Message either
mark
This student has
(2). Determine if the passed
student passed or OR
failed. This student has
failed
(3). Print appropriate
message either
student passed or
failed.
Pseudocode Algorithm
Algorithm Student Passed or Failed
This algorithm accepts a student’s mark. If the student’s mark is
greater than or equal to 50, it prints “This student has passed”. If the
student’s mark is less than 50, it prints “This student has failed”.
Variable Name Variable Data Type Variable Description
mark Integer Stores the student’s
mark
Rayad S. Ali
4.2 IT
START
Read mark
If mark >= 50 then
Print ‘This student has passed’
Else
Print ‘This student has failed’
End if
STOP
Rayad S. Ali
4.2 IT
Flowchart
START
Read mark
YES NO
mark >= 50
Print ‘This student Print ‘This student
has passed’ has failed’
STOP
Rayad S. Ali
4.2 IT
Trace Table
Test Data Set #1
Mark=20
Instructions in Mark Output
execution
START
Read mark 20
If mark >= 50 then
Else
Print ‘This student has ‘This student has failed’
failed’
End if
STOP
Test Data
Test Data Set #1
Mark=75
Instructions in Mark Output
execution
START
Read mark 75
If mark >= 50 then
Print ‘This student has ‘This student has Passed’
passed’
End if
STOP
Rayad S. Ali
4.2 IT
Pascal Program
Program Student_Passed_or_Failed; // This is the Program Header //
//This program accepts a student’s mark. If the student’s mark is
greater than or equal to 50, it prints “This student has passed”. If the
student’s mark is less than 50, it prints “This student has failed”.//
Var // This is the Variable Declaration //
mark:Integer;
BEGIN // The body of the program starts here //
Writeln ('Please enter student''s mark');
Readln (mark);
IF mark >= 50 THEN
BEGIN
Writeln ('This student has passed');
END
ELSE
BEGIN
Writeln ('This student has failed');
END;
Readln;
END. // The body of the program ends here //