Ask Question

2-3 Calculating the Body Mass Index (BMI). (Programming Exercise 2.14) Body Mass Index is a measure of health based on your weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters. Write a program that prompts the user to enter a weight in pounds and height in inches and displays the BMI. Note: One pound is 0.45359237 kilograms and one inch is 0.0254 meters. Hint: Convert the pounds entered into kilograms also convert the height in inches into meters Example: If you entered in pounds your weight as 95.5 and your height as 50 inches then the calculated BMI is 26.8573 FYI: BMI

+2
Answers (1)
  1. 2 June, 12:11
    0
    weight = float (input ("Enter your weight in pounds: "))

    height = float (input ("Enter your height in inches: "))

    weight = weight * 0.45359237

    height = height * 0.0254

    bmi = weight / (height * height)

    print ("Your BMI is: %.4f" % bmi)

    Explanation:

    *The code is written in Python.

    Ask the user to enter weight in pounds and height in inches

    Convert the weight into kilograms and height into meters using given conversion rates

    Calculate the BMI using given formula

    Print the BMI
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “2-3 Calculating the Body Mass Index (BMI). (Programming Exercise 2.14) Body Mass Index is a measure of health based on your weight. It can ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers