Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hastwoLower::Int->Int->Int->Int->Int->Bool
- hastwoLower a b c d e | (a <= b) && (a <= c) && (a <= d) && (a <= e) == True = False
- | (a <= b && a <= c) || (a <= b && a <= d) || (a <= b && a <= e) ||
- (a <= c && a <= d) || (a <= c && a <= e) ||
- (a <= d && a <= e) == True = True
- | otherwise = False
- hastwoUpper::Int->Int->Int->Int->Int->Bool
- hastwoUpper a b c d e | (a >= b) && (a >= c) && (a >= d) && (a >= e) == True = False
- | (a >= b && a >= c) || (a >= b && a >= d) || (a >= b && a >= e) ||
- (a >= c && a >= d) || (a >= c && a >= e) ||
- (a >= d && a >= e) == True = True
- | otherwise = False
- mediana::Int->Int->Int->Int->Int->Int
- mediana a b c d e | hastwoLower a b c d e && hastwoUpper a b c d e == True = a
- | hastwoLower b c d e a && hastwoUpper b c d e a == True = b
- | hastwoLower c b a d e && hastwoUpper c b a d e == True = c
- | hastwoLower d b c a e && hastwoUpper d b c a e == True = d
- | hastwoLower e b c d a && hastwoUpper e b c d a == True = e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement