Created
November 30, 2010 06:10
-
-
Save MelanieS/721248 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
#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