Professional Documents
Culture Documents
Sciences
By
Dr. Ali Kamel Abdel-Rahman
Mechanical Engineering Department
Decision Structures in FORTRAN
a1 op a2
where a1 and a2 are arithmetic expressions, variables,
constants, or character strings; in short, things that have
values that can be compared.
Relational
Logic Operator Meaning
.EQ. Equal
.NE. Not equal
.LT. Less than
.LE. Less than or equal
.GT. Greater than
.GE. Greater than or equa1
Combinational
Logic Operator Meaning
.OR. Or
.AND. And
.NOT. Not (Changes a value <true> into
a value <false> and vice versa)
READ*, A,B,C
DISCR = B**2 – 4.0*A*C
IF(DISCR .GT. 0.0) THEN
XXXXXX………………………
XXXXXX………………………
ELSE IF(DISCR .EQ. 0.0) THEN
XXXXXX……………………...
XXXXXX………………………
ELSE
XXXXXX……………... these statements are executed
XXXXXX……………... only if both IF tests fail
ENDIF
Number of Cycles
DO Statement Executed Comments
DO 44 I = 1, 5 5
DO 73 K = 5, 1 0
DO 73 K = 5, 1, -1 5 Negative steps
DO 11 M = 1, 9, 3 3
DO 15 X = 1., 4., 0.8 4
DO 15 M = 1., 4., 0.8
Non (execution- The loop limits are
time error; zero first converted to the
step not allowed) type of M, so this
statement is the same
as DO 15 M=1,4,0
DO 91 R = SQRT(2.), 5 4
GOTO label
where label is the statement label of an
executable statement