HASKELL   34

calc2

Guest on 22nd September 2022 12:29:31 AM

  1. module Calc
  2.         where
  3.  
  4. main = do
  5.         op <- getLine
  6.         num1 <- getLine
  7.         num2 <- getLine
  8.         putCalc op (read num1) (read num2)
  9.  
  10. putCalc :: String -> Integer -> Integer -> IO ()
  11. putCalc "+" n1 n2 = putStrLn (show (n1 + n2))
  12. putCalc "-" n1 n2 = putStrLn (show (n1 - n2))
  13. putCalc "*" n1 n2 = putStrLn (show (n1 * n2))

Raw Paste


Login or Register to edit or fork this paste. It's free.