! 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.20. Trade the values 1 and 2.
  program D20
    implicit none
    integer :: I
! start program D20
    write (unit = *, fmt = *) " Please enter 1 or 2. "
    read (unit = *, fmt = *) I
    write (unit = *, fmt = *) " Thank you.  You have entered: ", I
    select case (I)
      case (1)
        I = 2
      case (2)
        I = 1
      case default  ! Leave I value unchanged.
    end select
    write (unit = *, fmt = *) I, " was computed from the value you entered. "
    stop
  end program D20
