Computer Science, asked by rahulson630, 2 months ago

Explain the two types of constants and variables used in BASIC.Give example?​

Answers

Answered by Rangarao333
0

Answer:

Constants and Variables

Data is categorized as either constants or variables and either numeric or non-numeric.

Constants

Numeric Constant

May have sign in front of number

May have decimal point

No commas, dollar signs, percent signs

May be used in calculations

Examples of numeric constants

5 4.5 -7

Nonnumeric Constant

Anything enclosed in quotation marks is considered a Nonnumeric constant, also called string constants or alphanumeric constants or literals

Nonnumeric constants SHOULD NOT be used in calculations

Examples of nonnumeric constants

Variables

A variable is a named storage location (area of memory) that can contain data that can be modified during program execution. A variable can store only 1 item of data at any one time.

Programmers often need to store values for later use. For example, you may have values entered by a user for the number of hours worked and a rate of pay. You plan to multiply the two values and store the result in memory so you can use it later. For this you will need a variable.

Every variable has a Data Type. The data type specifies the kind of data the variable can store. As with constants all programming languages have at least two kinds of data types.

Nonnumeric data type (called String, Text, Alphanumeric, or Character data in different languages) can be used to store any kind of data.

Numeric data types are used to store numbers.

Different programming languages may have other data types.

When you declare a variable, memory space (dependant on the data type) is allocated to that variable and the kind of data the variable will hold is specified.

Each variable has a name that is supplied by the programmer. When the programmer references that variable name in the program they are accessing the value stored in the memory location associated with that variable.

Explanation:

Mark this answer as brainlist if you think this is useful for you.

All the best!!!

Similar questions