19 January 2012

A fortran 90 program to calculate the area of a triangle

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

0 comments:

Post a Comment