| Fortran Expression and I/O Statement |
| |
| Output statement |
| |
| The WRITE and PRINT statements are the data transfer output statements.
The information from the memory unit is delivered to output unit
and then the result or the value or the answer is display on the
computer screen. |
| The general form of the output statement is: |
| PRINT*, output-list |
| or |
| WRITE(*,*) output-list |
| output-list is a single expression or a list of expressions separated
by commas. Each of these expressions is a constant, a variable
or a formula. |
| This tells us that the value of the variables specified in the
list to be printed on computer's screen. |
| Example: |
| PRINT*, x, y, z |
| or WRITE(*,*) x, y, z |
| From the above example you can understand that " x, y and
z " are three variables and these are separated by commas. |
| Example: |
| PRINT*, 'THIS IS A SIMPLE PROGRAM::' |
This statement will print on your screen when program is being
executed. The output on your screen will come as: THIS IS A SIMPLE
PROGRAM::
This means the PRINT statement can be used in the program to give
good outlook to the output screen. |
| Naming Constants |
PARAMETER statement gives the clarification of this Naming Constant.
PARAMETER (PIE= 3.1416,C=3.8E+10) |
| Here PIE is a symbolical name of the constant 3.1413,and C is
the symbolical name of 3.8E+10. The value of the symbolic name
assigned in a PARAMETER statement should not be redefined. |
| |
| Lines |
| A line in a program unit is a sequence of 72 characters. In Fortran
you can put maximum 72 characters and minimum depend upon the
program or problem being solved. |
| |
| Comment Line |
| A comment line is any line that contains a C or an asterisk in
column 1, or contains only blank characters in columns 1 through
72. A comment line that contains a C or an asterisk in column
1 may contain any character capable of representation in the processor
in columns 2 through 72. |
| A comment line does not affect the executable program in any way
and may be used to provide documentation. |
| Comment lines may appear anywhere in the program unit. Comment
lines may precede the initial line of the first statement of any
program unit. Comment lines may appear between an initial line
and its first continuation line or between two continuation lines. |
| Example: |
| C WELCOME
TO eBIZ HOUSE |
| C ** THIS IS FORTRAN Comment |
| |
| |
|
| |
| |