Relational Logical Expressions in fortran

Relational Logical Expressions are expressed with the help of Relational operators.
Relational operators
These are the relational operators:
Mathematical symbol Meaning Fortran equivalent
> greater than .GT.
>= greater than or equal to .GE.
< less than .LT.
<= less than or equal to .LE.
= equal to .EQ.
<> not equal to .NE.
Example:
If A is greater than B then it is expressed in Fortran as:
.GT. B
similarly, A .LT. B and so on.
Logical Expressions
A logical expression is used to express a logical computation. Evaluation of a logical expression is expressed with a value of true or false.
Logical Operators are:
.NOT.
.AND.
.OR.
.EQV.
.NEQV.
The value of a logical term involving .AND. is shown as:
A1 A2 A1 .AND. A2
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE
Scroll to Top