FUNCTIONs

  ! -- program to determine least of three given values :
  PROGRAM least_of
    REAL :: first, second, third
    REAL :: least

    WRITE(UNIT=*, FMT=*) 'Enter three values...'
    READ(UNIT=*, FMT=*) first, second, third

    least = min(first, second)
    least = min(least, third)

    WRITE (UNIT=*, FMT=*) 'Least of the three numbers is: ', least
  END PROGRAM least_of

  ! -- subprogram returns a if a is less than b, otherwise returns b :
  FUNCTION min(a, b)
    REAL, INTENT(IN) :: a, b
    REAL             :: min

    IF (a < b) THEN
      min = a
    ELSE
      min = b
    END IF
  END FUNCTION min 


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_course_fortran_90/_reml_grp/index.reml
On: 10/2/2003 at 10:33:52
Options: reml2 -i noindex -l long -o html -p multiple