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:
- Measure your weight in kilograms.
- Measure your height in meters.
- Square your height (multiply height by itself).
- 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!
