Breaking News
yeni film izle hd film seyret film izle

Constant In Fortran

A constant is a number which does not change till the end of a program. As we know in algebra 1, 2, 3,………etc are constant which have same value as it is given and cannot be changed. Just like that Fortran language have also constant whose value does not vary up to the end of a program
It is clear from the above example that the value of 1 or 1234 or 89.43 will be always same and will never change.
Types of constants
a) Integer constants
Whole numbers without any fractional parts are called Integer constants. All integer constant must have at least one digit without decimal point. The largest integer constant depends on the computer being used. For IBM PCs and 32 bit work stations the range is
+ – 2147483647
If – or + sign is not given then according to the rule the sign will be considered as positive.
-986 etc.
It is wrong to show integer constant
.4 (decimal should not be given)
133.07 (decimal point is not allowed)
b) Real constants or Floating point constants
Real constant or Floating constant are same. Users should not confuse about these name. They may have fractional parts.
Rules of Real Constants
Rule 1
A Real constant in a fractional form must have at least one digit and must be written with a decimal point. It may have either the + or the – sign preceding it. If a sign does not precede it then it is assumed to be positive.
This means only +, – or . (decimal point) are allowed.
It is wrong to show: 1 (decimal point is must otherwise it will be an integer constant)
It should be written as: 1.0
Rule 2
A Real constant in the exponent form consists of a mantissa and an exponent. The mantissa must have at least one digit and a decimal point. The mantissa is followed by the latter E and the exponent. The exponent must be an integer (without a decimal point) and must have at least one digit. A sign for the exponent is optional.
-123.456E+54 etc.
c) Character Constants
A character constant is any sequence or group of characters enclosed in apostrophes
The group of characters enclosed between apostrophes (‘), is known as character constant or literal constant. An apostrophes is only a control character and it may appear in a constant as control character
‘A’, ‘ASDF’, ‘RAM’, ‘X+Y+Z’, etc
Apostrophes themselves are represented using two apostrophes. e.g. SHIV’S FRIEND can be represented as: ‘SHIV”S FRIEND’