QBASIC CONSTANTS

  admin       September 7, 2019      1449

QBASIC CONSTANTS

The data or the values that are used in a program are known as constants and they cannot be changed during the program execution. The data may be a letter, words, numbers, or special characters. A constant can be stored in a variable when it is required to use in more than one statement or expression. These data or constants are grouped into two major categories. They are:

a. String Constant
b. Numeric Constant

a. String Constant

String constants is a set of characters, numbers, special characters enclosed in double quotes. Mathematical operations cannot be performed on String Constants. Example: “Hello World”, “Nepal”, “ Hi Tech Computer”, “Contact No. 9847875648”, “Welcome to our company”, “Ram”, “My School” etc.

b. Numeric Constant

Numeric constants which hold numeric data or values is called numeric constants. Which can be performed Mathematical and logical operations. Numeric data should not be enclosed in double quotes. Thousand separators are not allowed to use in numeric constant. Example: +108, -110, 105.50, 720, 45603, etc.

Numeric Constants may be integer, long integer, single precision or double precision.

  • Integer:Integer is whole number between -32768 to 32767.
  • Long Integer:Long Integer is a large range of whole number between -2,147,483,648 to +2,147,483,647
  • Single Precision:Single Precision is seven digit or less than seven digit positive or negative number that contains decimal point. Single Precision can be in the exponential form using E or with a trailing exclamation point. (!). 564, 78.65, 1.2 E-06 and 12345.678! are some examples of Single Precision Constants.
  • Double Precision:Double Precision is 17 digit or less than 17 digit positive or negative numbers that contains decimal point. Double Precision can be in the exponential form using D or with trailing hash sing (#). 9999.99D-12, 2345.786# and 3456.78 are some examples of Double Precision Constants.

Leave a Reply

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