Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main = do
- putStrLn ("Podaj liste L: ")
- input1 <- getLine // czyta stringa
- let l = (read input1 :: [Int]) //przeczyta ze stringa liste
- putStrLn ("Podaj liste M: ")
- input2 <- getLine
- let m = (read input2 :: [Int])
- let new_list = l ++ m
- let sum n = if null n
- then 0
- else (head n) + sum (tail n)
- let result1 = sum new_list
- let mult n = if null n
- then 1
- else (head n) * mult (tail n)
- let result2 = mult new_list
- putStrLn ("Suma: " ++ (show result1)) //zamieni liste znowu na stringa
- putStrLn ("Iloczyn: " ++ (show result2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement