How to calculate BMI?

0135

To calculate Body Mass Index (BMI), you can use the following formula:

[
\text{BMI} = \frac{\text{weight}}{\text{height}^2}
]

Where:

  • weight is in kilograms (kg)
  • height is in meters (m)

Steps to Calculate BMI:

  1. Measure your weight in kilograms.
  2. Measure your height in meters.
  3. Square your height (multiply height by itself).
  4. Divide your weight by the squared height.

Example in Python:

Here's a simple Python function to calculate BMI:

def calculate_bmi(weight, height):
    bmi = weight / (height ** 2)
    return round(bmi, 2)

# Example usage
weight = 70  # in kg
height = 1.75  # in meters
bmi = calculate_bmi(weight, height)
print(f"My BMI is {bmi}")

This will output the BMI rounded to two decimal places. If you have any further questions or need clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!