next up previous contents
Next: Simple example of a Up: Simple example of Subroutine Previous: Simple example of Subroutine

Solution

Note INTENT is not essential as it may not have been covered in the course so far.

    PROGRAM Main
     IMPLICIT NONE
     REAL  :: answer

      CALL Summy2(answer,2.6,3.1)
      PRINT*, answer
      CALL Summy2(answer,6.1,9.2)
      PRINT*, answer
      CALL Summy2(answer,.1,.555)
      PRINT*, answer

    CONTAINS

     SUBROUTINE Summy2(res,x,y)
      REAL, INTENT(IN) :: x, y 
      REAL, INTENT(OUT) :: res
       res = x+y
     END SUBROUTINE Summy2

    END PROGRAM Main


next up previous contents
Next: Simple example of a Up: Simple example of Subroutine Previous: Simple example of Subroutine

©University of Liverpool, 1997
Thu May 29 10:11:26 BST 1997
Not for commercial use.