Example Fortran 90 program:
MODULE Triangle_Operations IMPLICIT NONE CONTAINS FUNCTION Area(x,y,z) REAL :: Area ! function type REAL, INTENT( IN ) :: x, y, z REAL :: theta, height theta=ACOS((x**2+y**2-z**2)/(2.0*x*y)) height=x*SIN(theta); Area=0.5*y*height END FUNCTION Area END MODULE Triangle_Operations PROGRAM Triangle USE Triangle_Operations IMPLICIT NONE REAL :: a, b, c, Area PRINT*, 'Welcome, please enter the& &lengths of the 3 sides.' READ*, a, b, c PRINT*,'Triangle''s area: ',Area(a,b,c) END PROGRAM Triangle
For more information, click here