      PROGRAM PROB01
C
C     PROBLEM 1
C
C  REFERENCE:  PROBLEMS TO TEST PARALLEL AND VECTOR LANGUAGES
C              CSD-TR 516, COMPUTER SCIENCE, PURDUE UNIVERSITY
C              JOHN R. RICE, MAY 1, 1985
C
C              REVISED BY JOHN R. RICE AND J. JING, OCT. 1, 1990
C
C
C      *************************************************
C      *      Adapted for FORTRAN D benchmarking       *
C      *    by  T. HAUPT  (haupt@sccs.npac.syr.edu)    *
C      *                                               *
C      *    Northeast Parallel Architectures Center    *
C      *   at Syracuse University, Syracuse, NY, USA   *
C      *************************************************
C
C
C       VERSION SEQUENTIAL-1.00  (PLAIN FORTRAN77)
C       ==================================================
      INTEGER KASES,K,NK
      PARAMETER (KASES=6)
      INTEGER N(KASES)
      REAL TN
      REAL A,B,H
      DATA A,B / 0.0,1.0 /
      DATA N /  8192, 65536,
     X          131072, 262144, 524288, 1048576/
      REAL TARRAY(2),TIME1,TIME2
C
C               LOOP OVER KASES
C
      DO  K = 1, KASES
         NK=N(K)
      TIME1=DTIME(TARRAY)
         DO MANY=1,100

         H = (B-A)/(NK-1)
         CALL DOIT(NK-1,A,H,TN)
         TN = H*((EXP(A)+EXP(B))/2.+TN)

         ENDDO
      TIME2=DTIME(TARRAY)

         PRINT 30,A,B,NK
   30    FORMAT ('PROBLEM 1 WITH A,B,N = ',2F10.3,5X,I8)
         PRINT 40,TN
   40    FORMAT ('GIVES TN =',F10.6)

      PRINT *, 'TIME',TIME2,' SECONDS'
      PRINT *, 'USER:',TARRAY(1),' SYSTEM:',TARRAY(2)

      ENDDO

      STOP
      END



      SUBROUTINE DOIT(N,A,H,FSUM)
      INTEGER N
      REAL A,H,FSUM
      INTEGER I

      FSUM = 0.0
      DO I = 1, N-2
        FSUM = FSUM+EXP(A+H*I)
      ENDDO

      RETURN
      END
