Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main :: IO()
- main = do
- putStr "Enter number 1: "
- line1 <- getLine
- putStr "Enter number 2: "
- line2 <- getLine
- putStr "Enter operation: "
- op <- getLine
- let num1 = read line1 :: Int
- let num2 = read line2 :: Int
- print ((getOperation op) num1 num2)
- getOperation :: String -> (Int->Int->Int)
- getOperation "Plus" = \x y -> x + y
- getOperation "Minus" = \x y -> x - y
- getOperation "Mult" = \x y -> x * y
- getOperation "Div" = \x y -> x `div` y
- getOperation "Mod" = \x y -> x `mod` y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement