C AREA OF A TRIANGLE - HERON'S FORMULA
C INPUT - CARD READER UNIT 5, INTEGER INPUT
C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT
C INPUT ERROR DISPAYS ERROR MESSAGE ON OUTPUT
PROGRAM AREA
INTEGER A, B, C
CHARACTER MSGEND*40, MSGERR*40
MSGEND = "NORMAL END"
STRERR = "INPUT ERROR"
100 READ(5,10,END=200,ERR=300) A,B,C
10 FORMAT(3I5)
IF(A=0 .OR. B=0 .OR. C=0) THEN
WRITE(6,*) "Zero value not allowed"
ELSE
S = (A + B + C) / 2.0
AREA = SQRT( S * (S - A) * (S - B) * (S - C))
WRITE(6,601) A,B,C,AREA
20 FORMAT(" A=",I5,", B=",I5,", C=",I5,", AREA=",
* F10.2," SQUARE UNITS")
END IF
GO TO 100
200 WRITE(6,*) MSGEND
STOP
300 WRITE(6,*) MSGERR
STOP
END