You are viewing a single comment's thread. Return to all comments →
Haskel code
calcex :: Int -> Double -> Double calcex 10 _ = 1.0 calcex n x = 1.0 + x / fromIntegral n * calcex (n + 1) x evaluateSeries :: Double -> Double evaluateSeries x = calcex 1 x main :: IO () main = do n <- readLn :: IO Int inputs <- mapM (\_ -> readLn :: IO Double) [1..n] let outputs = map evaluateSeries inputs mapM_ print outputs
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Evaluating e^x
You are viewing a single comment's thread. Return to all comments →
Haskel code