Skip to content

Commit 2ac11f2

Browse files
committed
[exercise] 10.5
1 parent e01fb45 commit 2ac11f2

File tree

1 file changed

+10
-0
lines changed
  • chapter10-Interactive-programming

1 file changed

+10
-0
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)