! 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.5. Trade the values 1 and 2.
  program D05
    implicit none
    integer :: I
! start program D05
    write (unit = *, fmt = *) " Please enter 1 or 2. "
    read (unit = *, fmt = *) I
    write (unit = *, fmt = *) " Thank you.  You have entered: ", I
    if (I == 1) then  ! if construct
      I = 2  ! if construct
    else  ! if construct
      I = 1  ! if construct
    end if  ! if construct
    write (unit = *, fmt = *) " Your value was changed to: ", I
    stop
  end program D05
