QBASIC Statement

A QBASIC statement is a command to perform certain task. The followings are QBASIC statement 

  1. CLS
  2. PRINT
  3. END
  4. LET
  5. INPUT
  6. REM
1. CLS

Syntax
    CLS
It clears the screen.
eg. CLS

2. PRINT
Syntax
PRINT "Control String";Variable list
It is used to print values of variables .

Eg.
CLS
A=12
PRINT "The value of A is ";A
END

The output of the given program will be 
The value of A is 12 

3. END 
 Syntax
  END 
It terminates the program.

E.g.

CLS
A= 23
PRINT A
END


4. INPUT 

Syntax

INPUT "Control String";Variable

It allows us to enter a value from keyboard and assign this value in variable.

E.g.
CLS
INPUT "Enter a number1";N1
INPUT "ENter a number2";N2
S=N1+N2
PRINT "Sum of two numbers is ";S
END

This program allows us to input two numeric values and assign these value in variable N1 and N2 . The Program can calculate sum of these two numbers and finally print the result i.e. S. 
 
5. REM

Syntax 
REM  Remarks
This statement is used to write programmer remarks in program. The remarks can't be executed After the REM statement it is just a remarks which helps to memorize the meaning of the code just written in past time. 

We can use  '  instead of REM leywords

E.g.
CLS
REM this program calculate area of a square
INPUT "Enter a length";L
A=L^2
PRINT "Area of a square is ";A
END
 

Comments

Popular posts from this blog

PROGRAM TO FIND SQUARE, CUBE, SQUARE ROOT AND CUBE ROOT OF GIVEN NUMBER

PALINDROME AND ARMSTRONG PROGRAMS

PROGRAM TO DISPLAY SUM, PRODUCT, DIFFERENCE AND PRODUCT OF TWO / THREE NUMBERS