Created
March 20, 2012 21:26
-
-
Save bbhoss/2141454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| calcBMI :: Float -> Float -> Float | |
| calcBMI heightIn weightLbs = (weightLbs*703)/heightIn^2 | |
| promptFloat :: String -> IO Float | |
| promptFloat question = do | |
| putStrLn question | |
| return =<< readLn | |
| main = do | |
| weight <- promptFloat "What is your weight in pounds?" | |
| height <- promptFloat "What is your height in inches?" | |
| putStrLn ("Your weight is " ++ show weight ++ "lbs. and your height is " ++ show height ++ "in.") | |
| putStrLn $ "Your BMI is " ++ (show $ calcBMI height weight) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment