You are on page 1of 3

Delhi Public School – Ruby Park, Kolkata

CLASS 6

Computer Science(2021-22)

Study Material

Chapter 8: Programming With QBasic:

QBasic: It stands for ‘Quick Beginners All Purpose Symbolic Instruction Code’, a

Language developed by Microsoft for beginner programmers.

Main Features Of QBasic:

i) It is a simple and user-friendly language.

ii) It is one of the most accepted languages because it is a flexible language in which

modifications can be done easily.

iii) It can solve both, mathematical and logical problems.

Variable: A variable is used to store values in a program. In QBasic, you can store two

types of data in variables:

1. Numeric: To store numeric values, such as Roll no and Marks.

2. String: To store alphabets, such as name and address. Strings are declared using the

$(dollar) sign. You can also use numbers in string which do not require calculations.

CLS statement: The CLS statement allows you to clear the output screen.

REM statement: The REM statement is used to give comments. Comments are

explanatory statements included in the code and help anyone to understand the

code.
LET statement: The LET statement is used to assign the value of an expression to

a variable.

INPUT statement: The INPUT statement is used to prompt the user to enter the value

of a variable during the execution of a program.

PRINT statement: The PRINT statement is used to display the output of the program

on the screen.

END statement: The END statement stops the further processing of the QBasic

statements.

Example Of QBASIC Programs:

1.) Write a QBASIC program to input two numbers and print their subtraction.

CLS

REM To calculate subtraction between two numbers

INPUT “Enter the two numbers”; A, B

LET S= A-B

PRINT “The Result =”; S

END
2.) Write a program to input side of a square and print area and perimeter

of a square.

CLS

REM To calculate area and perimeter of a square

INPUT “Enter the side of a square”; S

LET area= S*S

LET perimeter=4*S

PRINT “The area of square=”; area

PRINT “The perimeter of square=”; perimeter

END

3.) Write a program to display Name, Age and Address of a student:

CLS

REM To display Name, Age and address of a student

INPUT “Enter your name”;N$

INPUT “Enter your age”;Age

INPUT “Enter your address”;Add$

PRINT “My name is ”;N$

PRINT “My age is”;Age

PRINT “My address is”;Add$

END

You might also like