Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main :: IO ()
- main = do
- putStrLn "Enter numbers: "
- putStrLn "These will be summed until zero is entered."
- sum <- sumInts
- print sum
- get_Int :: IO int
- get_Int = do
- a <- getLine
- return (read a :: Int)
- sumInts :: IO int
- sumInts = do
- num <- get_Int
- if num == 0
- then return 0
- else (do sum <- sumInts
- return (num+sum))
Add Comment
Please, Sign In to add comment