module common public :: initial,add,multiply integer, parameter, public :: double = 2 real (kind = double), public :: x,y contains subroutine initial() print *, "x = ?" read *,x print *, "y = ?" read *,y end subroutine initial subroutine add(sum2) real (kind = double), intent (in out) :: sum2 sum2 = x + y end subroutine add subroutine multiply(product2) real (kind = double), intent (in out) :: product2 product2 = x*y end subroutine multiply end module common program tasks ! illustrate use of module and subroutines ! note how variables are passed use common real (kind = double) :: sum2, product2 call initial() ! initialize variables call add(sum2) ! add two variables call multiply(product2) print *, "sum =", sum2, "product =", product2 end program tasks