Physics, asked by thakurpratikshit79, 7 months ago


Q2 Explain Various types of variable and constants



Answers

Answered by rakshithan702
0

Explanation:

variable is something that may change in value. A variable might be the number of words on different pages of this booklet, the air temperature each day, or the exam marks given to a class of school children.

A variable could be likened to a storage box whose contents may often change. The box, or variable must be given a name to distinguish it from others. According to FORTRAN rules, the variable name must begin with a letter and may be followed by up to five characters (letters or numbers only).

Variables in FORTRAN are of different types. You specify the type and name of each variable you intend to use at the top of your program, after the PROGRAM statement and before any other executable lines. Commented lines are non executable so they can appear anywhere in the program.

If the variable declarations are omitted, the compiler will make certain assumptions, for example, that any variables beginning with the letters I, J, K, L, M, N are INTEGER. The lack of specification often leads to program errors and it is strongly recommended that variable types are always declared. Numerical data may be separated into integer and real numbers.

Constants are quantities whose values do not change during program execution. In FORTRAN they may be of numeric or character type.

Double Precision

Real data values are commonly called single precision data because each real constant is stored in a single memory location. This usually gives seven significant digits for each real value. In many calculations, particularly those involving iteration or long sequences of calculations, single precision is not adequate to express the precision required. To overcome this limitation , FORTRAN provides the double precision data type. Each double precision is stored in two memory locations, thus providing twice as many significant digits.

The general form of the declaration of a double precision variable is:

DOUBLE PRECISION namel, name2

Example

DOUBLE PRECISION ROOT, VELO

hope this is helpful please mark me as brain list please thank me rate me please

Answered by yashika8435
1

Explanation:

A variable is a named memory location which temporarily stores data that can change while the programme is running:

  • Explanation: A constant named memory location which temporarily stores data that remains the same throughout the execution the programme
Similar questions