Question 1 Report
Write a QBASIC program to grade any score entered from the keyboard as either "Poor" for a score that is below 50% or "Satisfactory" for a score that is equal to or above 50%. The program execution should stop as soon as a score that is less than zero is entered.
QBASIC program to grade a score as "Poor" or "Satisfactory"
The program keeps asking for a score. If the score entered is less than zero, it stops immediately. Otherwise it prints "Poor" for a score below 50 and "Satisfactory" for a score of 50 or above.
REM Program to grade scores
CLS
DO
INPUT "Enter a score (negative to stop): ", SCORE
IF SCORE < 0 THEN
EXIT DO
END IF
IF SCORE < 50 THEN
PRINT "Poor"
ELSE
PRINT "Satisfactory"
END IF
LOOP
ENDHow it works:
SCORE < 0, the EXIT DO statement ends the loop and the program stops.Alternative using GOTO (also acceptable):
CLS
Start:
INPUT "Enter a score: ", SCORE
IF SCORE < 0 THEN END
IF SCORE < 50 THEN PRINT "Poor" ELSE PRINT "Satisfactory"
GOTO StartEverything you need to excel in your exams