Constant in QBASIC

A contstant is a variable whose value do not change during the execution of a program.
A constant is something a universal value like value of pi, value of g, value of G, value of e in science.

In QBASIC the constant can be declared by using CONST keyword.


Syntax:

CONST variable=Value


Types of Constant

  1. Numeric constant
  2. String constant
1. Numeric constant:
A constant which can hold numeric value is called numeric constant.
e.g.

CONST pi=22/7
CONST g=9.8

2. String constant:
A canstant which can hold string value is called string constant.

e.g.

CONST N$="Ramesh"
CONST place$="Kirtipur 7, Kathmandu"


Note: 
Keyword is a reserved word which has fixed meaning .
e.g. 
CONST for declaring constant
PRINT for displaying value in console screen


Comments

Popular posts from this blog

input any string and reverse it, palindrome

PALINDROME AND ARMSTRONG PROGRAMS

N NE NEP NEPA NEPAL PATTERN