September 2015
Beginner
110 pages
2h 6m
English
| 19 | BMI Calculator |
You’ll often need to see if one value is within a certain range and alter the flow of a program as a result.
Create a program to calculate the body mass index (BMI) for a person using the person’s height in inches and weight in pounds. The program should prompt the user for weight and height.
Calculate the BMI by using the following formula:
If the BMI is between 18.5 and 25, display that the person is at a normal weight. If they are out of that range, tell them if they are underweight or overweight and tell them to consult their doctor.
| | Your BMI is 19.5. |
| | You are within the ideal weight range. |
or
| | Your BMI is 32.5. ... |
Read now
Unlock full access