! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 3.12. Compute Y by one of three formulas, depending on X.
  program D12
    implicit none
    real :: X, Y
! start program D12
    write (unit = *, fmt = *) " Please enter the value of X. "
    read (unit = *, fmt = *) X
    if (X < 0.0) then
      Y = 1.0
    else if (X <= 1.0) then
      Y = 4.0 * X + 1.0
    else
      Y = -10.0 * X + 15.0
    end if
    write (unit = *, fmt = *) " The values of X and Y are: ", X, Y
    stop
  end program D12
