! 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.18. Memory allocation.
  program D18
    implicit none
    integer :: Address
! start program D18
    write (unit = *, fmt = *) " Please enter a memory address, expressed in kilobytes. "
    read (unit = *, fmt = *) Address
    select case (Address)
      case (: -1)
        write (unit = *, fmt = *) "The address ", Address, " does not exist in memory. "
      case (0: 639)
        write (unit = *, fmt = *) "The address ", Address, " is in Conventional Memory. "
      case (640: 1023)
        write (unit = *, fmt = *) " The address ", Address, " is in the Upper Memory Area. "
        write (unit = *, fmt = *) " (This is a part of Extended Memory.) "
      case (1024: 1087)
        write (unit = *, fmt = *) " The address ", Address, " is in the High Memory Area. "
        write (unit = *, fmt = *) " (This is a part of Extended Memory.) "
      case (1088: )
        write (unit = *, fmt = *) "The address ", Address, " is in Extended Memory. "
    end select
    stop
  end program D18
