小编ozh*_*ank的帖子

在Haskell中有更好的方法吗?

我写了以下内容来帮助大孩子们完成他们的家庭教育工作,并通过学习如何编程来保持思维工作(我认为haskell听起来很棒).

main :: IO ()
main = do
   putStrLn "Please enter the dividend :"
   inputx  <- getLine
   putStrLn "Please enter the divisor :"
   inputy  <- getLine
   let x = (read inputx) :: Int
   let y = (read inputy) :: Int
   let z = x `div` y
   let remain = x `mod` y
   putStrLn ( "Result: " ++ show x ++ " / " ++ show y ++ " =  " ++ show z ++  " remainder " ++ show remain …
Run Code Online (Sandbox Code Playgroud)

haskell integer-arithmetic

6
推荐指数
1
解决办法
213
查看次数

标签 统计

haskell ×1

integer-arithmetic ×1