repl.it
@anonymous/

PunyDefiniteExtension

Haskell

No description

fork
loading
Files
  • main.hs
main.hs
1
2
3
4
5
6
7
8
9
average :: Float -> Float -> Float -> Float -> Float
average x1 x2 y1 y2 =
    (fromIntegral $ round $ (y1 * y2 - x1 * x2) * 100 / (y2 - x2) / 100 * 10) / 10

main :: IO ()
main = do
    print $ average 7.9 100 7 200 -- 6.1
    print $ average 7.9 500 7 600 -- 2.5
    print $ average 7.9 100 7 600 -- 6.8
GHCi, version 8.6.5