Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Created February 15, 2015 15:57
Show Gist options
  • Save amonshiz/8e9ac062fa83206d9236 to your computer and use it in GitHub Desktop.
Save amonshiz/8e9ac062fa83206d9236 to your computer and use it in GitHub Desktop.
expectedValue :: Fractional a => a -> a -> a -> a -> a -> a -> a
expectedValue n1 n2 n3 n4 n5 n6 = 2 * (n1 + n2 + n3) + 1.5 * n4 + n5
main = do
numString <- getLine
let nums = map read $ words numString :: [Double]
putStrLn . show $ expectedValue (nums!!0) (nums!!1) (nums!!2) (nums!!3) (nums!!4) (nums!!5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment