PROGRAM Exponential
   IMPLICIT NONE
 
   INTEGER         :: Count
   REAL            :: Term, Sum, Number 
   REAL, PARAMETER :: Tolerance = 0.00001

   READ(*,*) Number
   Count = 1 
   Sum = 1.0
   Term = Number
   
   DO
      IF ( ABS(Term) < Tolerance ) EXIT
      Sum   = Sum + Term
      Count = Count + 1
      Term  = Term * ( Number / Count ) 
   END DO

   WRITE(*,*) 'After ', Count, ' iterations:'
   WRITE(*,*) '  EXP(', Number, ') = ', Sum
   WRITE(*,*) '  From EXP()     = ', EXP(Number)
   WRITE(*,*) '  ABS(error)     = ', ABS( Sum - EXP(Number))

END PROGRAM Exponential
