Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- lista1.hs
- -- Kevin KDOXG
- -- Telegram: @kdoxg
- -- Ex. 1
- osQuatroSaoIguais :: Int -> Int -> Int -> Int -> Bool
- osQuatroSaoIguais a b c d = (a == b) && (b == c) && (c == d)
- -- Ex. 2
- quantosSaoIguais :: Int -> Int -> Int -> Int
- quantosSaoIguais a b c
- | (a == b) && (b == c) = 3
- | ((a == b) && (a /= c)) || ((b == c) && (a /= b)) || ((a == c) && (a /= b)) = 2
- | otherwise = 0
- -- Ex. 3
- todosDiferentes :: Int -> Int -> Int -> Bool
- todosDiferentes a b c
- | (a == b) && (b == c) = False
- | ((a == b) && (a /= c)) || ((b == c) && (a /= b)) || ((a == c) && (a /= b)) = False
- | otherwise = True
- -- Ex. 4
- vendas :: Int -> Int
- vendas 0 = 16
- vendas 1 = 32
- vendas 2 = 64
- vendas 3 = 128
- vendas _ = 69
- vendaTotal :: Int -> Int
- vendaTotal 0 = vendas 0
- vendaTotal n = vendas n + vendaTotal (n-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement