Mixed expressions |
Mixed expressions in Arithmetic Expression are formed by using different types of integer, real, double precision or complex quantities. |
Example: |
Consider an arithmetic expression in which integer and real quantities occurs let I=5 and C= 2.5.This means here I is integer and C is real .If both are added then I + C = 7.5 |
Here the integer value is automatically converted into real value, that means 5 becomes 5.0.And the value of I remains the integer in the computer memory. |
Character Expressions |
Character expression is an expression whose operands have the character type. Expression Meaning |
a // z concatenate a with z |
Consider A1, A2, A3 are declared as complex then it will be written in program as: |
COMPLEX A1, A2, A3 |
If A1 = (1.5, 2.5), A2 =(2.0, 3.5) and A3 = (1.0, 2.0) then Fortran expression for the evaluation (1.5, 2.5) + (2.0, 3.5) – (1.0, 2.0) will be A1 + A2 -A3. Similarly other examples can be also written. |
Example: |
– IC * IA +IB |
Here IC, IA, IB are unsigned integer variable and -, +, and * are arithmetic operators. |
3) An integer expression enclosed in parentheses is an integer expression. |
Example: |
( -J * K +I) is an integer expression.; |
Note: Two arithmetic operators should not occur in succession in an integer expression. |
This is wrong to express: |
Example: |
IC -* IA |