QBASIC – Eligible to vote or not.

Table of Contents

Overview

Below is the program to check whether a person is eligible to vote or not.

REM Program to check if a person is eligible to vote or not
CLS
INPUT "Enter a person's age: "; age
IF age >= 18 THEN
  PRINT "Person is eligible to vote"
ELSE 
  PRINT "Person is not eligible to vote"
END IF
END

Output

Outputs “Person is not eligible to vote” if age is input as 16

Explanation

To check if the person is eligible to vote or not, first, ask the user the age of the person and check if the age is greater than or equal to 18 (>=18), if the condition satisfies, display the person is eligible to vote else display not eligible.

More Programs

https://thinkshare.one/learn/programming/qbasic/

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version