← Back to If Statements
Question 242
BMI Category
BMI Category
Two variables are given: weight in kilograms and height in metres. Compute the body mass index as weight divided by height squared and store it in a constant called bmi. Then print the category with an if / else if / else chain:Underweightbelow 18.5,Normalfrom 18.5 up to but not including 25,Overweightfrom 25 up to but not including 30, andObeseat 30 or more.
Expected Output:
Normal= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.