Haskell
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
Playground
Hosted on Repl.it.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Haskell
Playground
Hosted on Repl.it.