Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Created January 16, 2015 03:15
Show Gist options
  • Save amonshiz/3a352b0e0abd6534f799 to your computer and use it in GitHub Desktop.
Save amonshiz/3a352b0e0abd6534f799 to your computer and use it in GitHub Desktop.
Introduction to Mendelian Inheritance
mendelsFirstLaw :: Float -> Float -> Float -> Float
mendelsFirstLaw k m n = ((k**2 - k) + (2.0 * k * m) + (2.0 * k * n) + (m * n) + (0.75 * (m**2 - m))) / ((k + m + n) * (k + m + n - 1))
main = do
k <- getLine
m <- getLine
n <- getLine
putStrLn . show $ mendelsFirstLaw (read k :: Float) (read m :: Float) (read n :: Float)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment