home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LANGUAGE / FORTRAN / F77TO90 / code / tpkf.f < prev   
Text File  |  1996-05-08  |  650b  |  29 lines

  1.  
  2.       module Functions
  3.       public :: fun
  4.       contains
  5.          function fun(t) result (r)
  6.             real, intent(in) :: t
  7.             real  :: r
  8.             r = sqrt(abs(t)) + 5.0*t**3
  9.          end function fun
  10.       end module Functions
  11.  
  12.       program TPK
  13. !     The TPK Algorithm
  14. !     F style
  15.       use Functions
  16.       integer            :: i
  17.       real                  :: y
  18.       real, dimension(0:10) :: a
  19.       read *, a
  20.       do i = 10, 0, -1      ! Backwards
  21.          y = fun(a(i))
  22.          if ( y < 400.0 ) then
  23.             print *, i, y
  24.          else
  25.             print *, i, " Too large"
  26.          end if
  27.       end do
  28.       end program TPK
  29.