2008 Canadian Computing Competition, Stage 1

Problem J1: Body Mass Index

The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult's health. The doctor measures the patient's height (in metres) and weight (in kilograms), then calculates the BMI using the formula

           weight
BMI = ------------------ height × height

Write a program which takes in the patient's height and weight, calculates the BMI, and displays the corresponding message from the table below.

BMI Category Message
More than 25 Overweight
Between 18.5 and 25.0 (inclusive) Normal weight
Less than 18.5 Underweight

Sample Input 1

69
1.73

Sample Output 1

Normal weight

Explanation

The BMI is 69 / (1.73 × 1.73), which is approximately 23.0545. According to the table, this is a "Normal weight".

Sample Input 2

84.5
1.8

Sample Output 2

Overweight

Explanation

The BMI is 84.5 / (1.8 × 1.8), which is approximately 26.0802. According to the table, this is "Overweight".

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 28, 2008

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

how do we add a decimal module in python3 whenever i input a decimal it doesnt work, also what was wrong with my code

Instead of using "input()", you have to use "float(input())". This lets the computer know that you are using decimals.

I mean you could use double but ok


Chances are, if 700 other users have solved it, it's not broken.