Skip to content

Instantly share code, notes, and snippets.

@bbhoss
Created March 20, 2012 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbhoss/2139573 to your computer and use it in GitHub Desktop.
Save bbhoss/2139573 to your computer and use it in GitHub Desktop.
BMI Calculator
calcBMI :: Float -> Float -> Float
calcBMI heightIn weightLbs = (weightLbs*703)/heightIn^2
main = do
putStrLn "What is your weight in pounds?"
weight <- readLn :: IO Float
putStrLn "What is your height in inches?"
height <- readLn :: IO Float
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