Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Created November 30, 2010 06:10
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 MelanieS/721248 to your computer and use it in GitHub Desktop.
Save MelanieS/721248 to your computer and use it in GitHub Desktop.
#A lethal dose of Aspirin is 500 mg/kg of body weight.
# 1kg = 2.2 pounds.
# 325 mg tablets.
puts 'What is your weight in pounds?'
weight_in_pounds = gets.to_f
weight_in_kilos = weight_in_pounds / 2.2
puts weight_in_kilos.to_s + 'weight in kilos'
total_mg = weight_in_kilos * 500
puts total_mg.to_s + 'total milligrams needed'
number_of_tablets = total_mg / 325
puts number_of_tablets.to_i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment