next up previous
Next: Assessment Up: Implementation in Fortran Previous: Assignment Statements

Arithmetic Operations

Fortran supports the basic arithmetic operators:

You can group together parts of an expression with parentheses.

      result = (a + b) * c;

Our example Fortran program contains examples of the basic arithmetic operators.

Fortran provides for built-in procedures for certain mathematical functions. To invoke a built-in function, you write the name of the function followed by a list of arguments in parentheses. To use the sine function in Fortran statement, you would write:

      ... = ... sin( angle ) ...

where the angle is replaced with an expression that is the angle you want to take the sine of. The angle is measured in radians. Note that the value of the expression that you give to sin must be a real number, not an integer. We will talk about other built-in mathematical functions, and how you can write your own functions, in future lessons. For now you'll only need sine and cosine.


J. C. Diaz