Skip to content

Instantly share code, notes, and snippets.

@Luomint
Created April 14, 2015 14:22
Show Gist options
  • Save Luomint/82a3e6d6f6b41e5c39de to your computer and use it in GitHub Desktop.
Save Luomint/82a3e6d6f6b41e5c39de to your computer and use it in GitHub Desktop.
#BMI weight in pounds / height in inches
puts "enter height"
height = gets.to_f
puts "enter weight"
weight = gets.to_f
bmi = (weight * 703)/(height ** 2)
puts "your bmi is #{bmi}"
## why does the code line order of height = gets.to_i and weight.get_to affect the answer
## i.e. if I put weight variable above height, my answer is inverted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment