We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e01fb45 commit 2ac11f2Copy full SHA for 2ac11f2
chapter10-Interactive-programming/5.hs
@@ -0,0 +1,10 @@
1
+getInt :: IO Int
2
+getInt = do s <- getLine
3
+ return (read s :: Int)
4
+
5
+adder :: IO ()
6
+adder = do putStr "How many numbers? "
7
+ n <- getInt
8
+ ns <- sequence (replicate n getInt)
9
+ putStr "The total is "
10
+ putStrLn (show (sum ns))
0 commit comments