Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Like sscanf(s, "%d")
- scanInt :: String -> Int
- scanInt = read :: String -> Int
- -- Parse a string that contains a list of numbers
- readInts :: String -> [Int]
- readInts line = map scanInt (words line)
- calculate :: [Int] -> String
- calculate xs = show $ sum xs
- main = do
- line <- getLine
- xs <- readInts line
- putStrLn $ calculate xs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement