QBasic Programming

Input the age of a person and find out whether the person is eligible to drive or not. [age >=16]

REM
CLS
INPUT “ENTER YOUR AGE”; A
IF A >= 16 THEN
PRINT “YOU ARE ELIGIBLE TO DRIVE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO DRIVE”
END IF
END
USING SUB PROCEDURE

DECLARE SUB CHECK (A)
CLS
INPUT “ENTER YOUR AGE”; A
CALL CHECK (A)
END

SUB CHECK (A)
IF A >= 16 THEN
PRINT “YOU ARE ELIGIBLE TO DRIVE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO DRIVE”
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (A)
CLS
INPUT “ENTER YOUR AGE”; A
PRINT “YOU ARE “;CHECK$(A)
END
FUNCTION CHECK$ (A)
IF A >= 16 THEN
CHECK$ = “ELIGIBLE TO DRIVE”
ELSE
CHECK$ = “ NOT ELIGIBLE TO DRIVE”
END IF
END FUNCTION

Input a mark in a subject of a student and check if the student is pass or nor. [Pass Mark >=40] (Prev Lesson)
(Next Lesson) Input the age of a person and find out whether the person is eligible to vote or not. [age >=18]
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!