averageThree :: Float -> Float -> Float -> Float
averageThree a b c = (a + (b + c))/3.0
isAbove :: Float -> Float -> Int
isAbove a avg
| a > avg = 1
| otherwise = 0
numAbove :: Float -> Float -> Float -> Int
numAbove a b c = (isAbove a avg) + (isAbove b avg) + (isAbove c avg)
where
avg = averageThree a b c
No comments:
Post a Comment