# Real & Complex Expressions

 Real Expressions There are following rules to express the Real expressions: 1) A signed or unsigned real variable name or real constant is an expression. Example: -A, 3.8, 2.0 etc. 2) A real expression connected by an arithmetic operator to an unsigned real variable name or an unsigned real constant is a real expression. Example: -A +B *c, A/B etc. 3) A real expression enclosed in parentheses is a real expression. Example: (-A +B *c) 4) Two real expression connected by an arithmetic operator is a real expression. Example: A + B + AB 5) A real expression may be exponentiatede by an integer expression to form a real expression. Example: B ** I, (A +B) ** (I + J) etc. Now users can easily write the arithmetic expression according to the rule of Fortran. Example: a3 – b2 + 3ab is written in Fortran language as: A***3 – B**2 + 3*A*B Complex Expressions Complex Expression in arithmetic expressions are formed by using complex quantities. Example: 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
Scroll to Top