In many previous example, there are several internal functions packed at the end of the main program. In fact, many of them such as Factorial(), Combinatorial(), GCD(), and Prime() are general functions that can also be used in other programs. To provide the programmers with a way of packing commonly used functions into a few tool-boxes, Fortran 90 has a new capability called modules. It has a syntactic form very similar to a main program, except for something that are specific to modules.
MODULE module-name IMPLICIT NONE [specification part] CONTAINS [internal-functions] END MODULE module-name
The differences between a program and a module are the following:
MODULE SomeConstants IMPLICIT NONE REAL, PARAMETER :: PI = 3.1415926 REAL, PARAMETER :: g = 980 INTEGER :: Counter END MODULE SomeConstants
MODULE  SumAverage
CONTAINS
   REAL FUNCTION  Sum(a, b, c)
      IMPLICIT  NONE
      REAL, INTENT(IN) :: a, b, c
      Sum = a + b + c
   END FUNCTION  Sum
   REAL FUNCTION  Average(a, b, c)
      IMPLICIT  NONE
      REAL, INTENT(IN) :: a, b, c
      Average = Sum(a,b,c)/3.0
   END FUNCTION  Average
END MODULE  SumAverage
     
MODULE  DegreeRadianConversion
   IMPLICIT  NONE
   REAL, PARAMETER :: PI = 3.1415926
   REAL, PARAMETER :: Degree180 = 180.0
   REAL FUNCTION  DegreeToRadian(Degree)
      IMPLICIT  NONE
      REAL, INTENT(IN) :: Degree
      DegreeToRadian = Degree*PI/Degree180
   END FUNCTION  DegreeToRadian
   REAL FUNCTION  RadianToDegree(radian)
      IMPLICIT  NONE
      REAL, INTENT(IN) :: Radian
      RadianToDegree = Radian*Degree180/PI
   END FUNCTION  RadianToDegree
END MODULE  DegreeRadianConversion