C  Author:   Mitch Richling<http://www.mitchr.me/>
C  IP:       Copyright 1993 by Mitch Richling.  All rights reserved.
C  Key word: statement function FORTRAN f77
C  Notes:    Illustrates statement functions in Fortran 77
C            
       program statf

C      The one line STATEMENT function.  They are local
C      to the unit they are defined in.  They must
C      be one line.  You declare them just as you do
C      variables.

       real avg4
       real a, b, c, d

       AVG4(a, b, c, d) = (a+b+c+d)/4
       write (*,*) 'avg(1,2,3,4)=', AVG4(1.0,2.0,3.0,4.0)

       end

