      module sky
        private
        public  :: sphere
        real,        dimension(5) :: bottom
        character*6, dimension(5) :: layer
        data bottom /    0.0,     5.0,    30.0,    50.0,   300.0 /
        data layer  /' Tropo','Strato','  Meso','  Iono','   Exo'/
        contains
          character*6 function sphere ( miles ) result ( zone )
            real, intent(IN) :: miles
            do i = 1, size(bottom), 1
               if ( miles .ge. bottom(i) ) zone = layer(i)
            end do
          end function sphere
      end module sky

      program atmosphere
      use sky
      real, dimension(3) :: altitude = (/ 1.2, 45.6, 789.0 /)
      print *, " "
      do i = 1, size(altitude), 1
         print 100, sphere ( altitude(i) ), altitude(i)
100      format ( ' ', a, 'sphere is the zone ',  &
                       'surrounding an altitude of ', &
                       f5.1, ' miles.' )
      end do
      print *, " "
      end program atmosphere
