`` Body Mass `` Calculate body mass index (BMI) for given height and weight. `` According to U.S. federal guidelines, a BMI of 24 or less is `` desirable. Anything higher is considered overweight. `` BMI is weight in kilograms divided by height in meters squared. `` Donated to the public domain, October 17, 1996. `` (Original author unknown.) `` This algo and lot of other ones may be found at: `` http://www.scriptol.org /* Function BodyMassIndex() Input: height in inches, weight in pounds Returns: - the Body Mass Index (BMI) - or nil if invalid height entered. */ int BodyMassIndex(int height, int weight) // Define the metric conversion constants... constant real LB_PER_KG = 2.2046 constant real INCH_PER_M = 39.37 if (height < 1) or (height > 100) return nil real factor = (INCH_PER_M * INCH_PER_M) / LB_PER_KG real formula = (((real(weight) * factor) / (height * height)) + 0.5) return int(formula) int main(int argc, array argv) int bmi, h, w if argc < 3 print "Usage: bodymass height-in-inches weight-in-pounds" return 0 /if dyn d = argv[1] h = d.toInt() d = argv[2] w = d.toInt() if (h < 20) or (h > 100) print "Height", h, "out of range..." return 0 /if if (w < 20) print "Weight",w,"out of range..." return 0 /if bmi = BodyMassIndex(h, w) print "Height", h, "inches, weight", w, "pounds, body mass", bmi if bmi < 25 print "Congratulations! Your are within the recommended range." else do w - 1 bmi = BodyMassIndex(h, w) /do while bmi > 24 print "Your index is above the recommended level of 24..." print "to reach that level your weight must drop to",w,"pounds." /if return 1 main($argc, $argv)