PROGRAM exponential
  IMPLICIT NONE

  INTEGER :: factorial(0:12), i, k
  DOUBLE PRECISION :: x, expseries, p

  DO k=0,12

     p = 1
     DO i = 1,k
        p = p * i
     END DO

     factorial(k) = p
 END DO

  PRINT *, "Dwse arithmo"
  READ *, x
  
  expseries = 0.0d0
  DO k=0,12
     expseries = expseries + x**k / factorial(k)
  END DO

  PRINT *, "to exp(", x, ") einai:"
  PRINT *, "proseggistika ", expseries
  PRINT *, "akribws ", EXP(x)

END PROGRAM exponential
