0% found this document useful (0 votes)
8 views1 page

Essential QBASIC Statements Explained

The document explains various programming statements used in QBASIC, including PRINT for displaying output, REM for comments, CLS for clearing the screen, LET for variable assignment, INPUT for user input, and IF...THEN...ELSE for conditional execution. It also covers loops, specifically the FOR...NEXT and WHILE...WEND structures for repeating statements, and defines arrays as collections of elements of the same data type. Additionally, it describes variables, their memory addresses, and strings as sequences of characters.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Essential QBASIC Statements Explained

The document explains various programming statements used in QBASIC, including PRINT for displaying output, REM for comments, CLS for clearing the screen, LET for variable assignment, INPUT for user input, and IF...THEN...ELSE for conditional execution. It also covers loops, specifically the FOR...NEXT and WHILE...WEND structures for repeating statements, and defines arrays as collections of elements of the same data type. Additionally, it describes variables, their memory addresses, and strings as sequences of characters.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Why do we use the following statements?

1. The PRINT statement is used to display numbers, messages or values of


variables on the output screen.
2. The REM statement is used to write a remark or a comment in the program
that does not get
3. The CLS statement is used to clear the output screen.
4. The LET statement is used to assign a value to a variable.
5. The INPUT statement is used to take a value from the user and store it in a
variable.
6. The IF…THEN…ELSE is a conditional statement that executes a set of
statements depending upon a condition.
LOOPS
A loop is used to repeat the execution of a group of statements many times.
FOR….. NEXT
1. WHILE…..WEND
The FOR…NEXT statement is used when you want a group of statements to be
executed a specific number of times.
SYNTAX OF
FOR…NEXT statement is given below.
FOR counter = initial value to final value [STEP value]
The loop body comprising a set of statements to be executed
NEXT counter

Define ARRAYS :
An Array is a collection of elements (variables) of the same data type.
ARRAY in QBASIC is used to store sequential values of same kind. We can use
array instead of using number of separate variables.

ARRAYS IN
b) To Input numbers into an array named n(15)
Ans- CLS
DIM n(15)
FOR a= 1 TO 10
INPUT "ENTER NUMBER- " ; n(a)
NEXT a
END
Write the statement for:
a) Declaring a numeric array of 10 numbers
Ans- DIM A(10)
Variable : A variable is a piece of data kept in the computer's memory (RAM). The
location of a variable in RAM is called the "address."
Strings : Strings contain a sequence of characters (letters, numbers, and symbols)
enclosed in quotation marks. For example, "HelloWorld!" is a string.
The following are also valid strings:
"0123456789"
"This is a string"
"abc123"
"1 + 1 = 2"
"Vashi"

You might also like