QBasic Programming

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

REM
CLS
INPUT “ENTER YOUR AGE”; A
IF A >= 18 THEN
PRINT “YOU ARE ELIGIBLE TO VOTE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO VOTE”
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 >= 18 THEN
PRINT “YOU ARE ELIGIBLE TO VOTE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO VOTE”
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 >= 18 THEN
CHECK$ = “ELIGIBLE TO VOTE”
ELSE
CHECK$ = “ NOT ELIGIBLE TO VOTE”
END IF
END FUNCTION

Input the age of a person and find out whether the person is eligible to drive or not. [age >=16] (Prev Lesson)
(Next Lesson) WAP to enter any 15 numbers and display only those numbers which are divisible by 5
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!