      program issorted
*****************************************************************
*                                                               *
*     Copyright 2011 Sourendu Gupta.                            *
*     This program is distributed without warranty under the    *
*     GNU General Public Licence.                               *
*                                                               *
************************************************************************
*                                                                      *
*     Test whether a list of numbers (one per line) is sorted.         *
*                                                                      *
************************************************************************
      read(*,*,end=11) r1
      line=1
*
 10   read(*,*,end=11) r2
         line=line+1
         if (r2.lt.r1) then
            write(*,*) 'Out of order on line ', line
            stop
         end if
         r1=r2
         go to 10
*
 11   stop
      end program issorted
