Pseudocode program to calculate Body Mass Index (BMI)
The Body Mass Index (BMI) is a quick way to assess your body size simply with your weight and height, regardless of your gender. Quickly calculate your BMI and find out which category you fall into.
The Body Mass Index (BMI) is the only index validated by the World Health Organization to assess an individual’s build and therefore health risks. The BMI makes it possible to determine whether one is the situation of thinness, overweight or obesity for example.
In this program we will calculate BMI. Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women.
Pseudocode– How to Calculate Body Mass index (BMI)
Write a program that calculates and displays a person’s body mass index (bmi) in pseudocode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | BEGIN DECLARE NUMBER height, weight, bmi DISPLAY "Enter person's information:" DISPLAY "height in inches? " INPUT height DISPLAY "weight in pounds? " INPUT weight height = height * 0.0254 # convert inches to meters weight = weight * 0.453592 # convert pounds to kilograms bmi = weight / (height * height) IF bmi < 18.5 DISPLAY "underweight" ELSE IF bmi >= 18.5 AND bmi < 25 DISPLAY "normal" ELSE IF bmi >= 25 AND bmi < 30 DISPLAY "overweight" ELSE DISPLAY "obese" END IF END |
This code calculates a person’s body mass index (BMI) and determines whether they are underweight, normal, overweight, or obese. Here is a brief explanation of how it works:
The program declares three variables: height, weight, and bmi.
The program prompts the user to enter the person’s height and weight, and stores the values in the height and weight variables.
You may also like: Pseudocode Examples
The program converts the height from inches to meters and the weight from pounds to kilograms.
The program calculates the person’s BMI by dividing the weight by the height squared.
The program uses an if-else statement to determine whether the person is underweight, normal, overweight, or obese based on their BMI.
The program prints out the person’s classification and then ends.
FlowChart– How to Calculate Body Mass index (BMI)
You May Also Like:
[…] Calculate Body Mass Index (BMI) in Pseudocode […]
[…] Calculate Body Mass Index (BMI) in Pseudocode […]
[…] Calculate Body Mass Index (BMI) in Pseudocode […]