005-002-012
If-Else: BMI Calculator
Hard
Problem Description
If-Else: BMI Calculator
Learning Objective: Use calculated results in conditional checks for classification
Overview
Create a program that calculates BMI from height and weight, then outputs the assessment.
Specifications
- Assign height 1.7 (meters) to variable
height - Assign weight 65.0 (kilograms) to variable
weight - Calculate BMI (BMI = weight / height squared)
- Assess based on:
- BMI below 18.5: "Underweight"
- BMI 18.5 to under 25: "Normal"
- BMI 25 to under 30: "Overweight"
- BMI 30 or above: "Obese"
- Output BMI value and assessment
Output Format
BMI: 22.49
Category: Normal
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
