148k views
5 votes
Write an Algorithm and draw a flowchart, which takes the weight and height of the user and calculate the BMI where BMI = height / weight, if BMI is more than 25, print "Perfect" otherwise print "Be careful".

User Yungchin
by
8.7k points

1 Answer

2 votes

Final answer:

The correct algorithm for calculating the Body Mass Index (BMI) involves inputting weight and height, using the formula BMI = weight (kg) / (height (m)²), and then printing "Perfect" if BMI <= 25, otherwise print "Be careful". A proper flowchart for the algorithm would show the sequence of steps and decision points.

Step-by-step explanation:

The Body Mass Index (BMI) is a method that relates body weight to height to assess if a person's body weight is healthy. The formula for calculating BMI uses height in meters and weight in kilograms, where BMI = weight (kg) / (height (m)²). However, in the context of the provided algorithm, there is a mistake in the formula as it should be BMI = weight (kg) / (height (m)²), not height / weight as the question states.

Here is the correct algorithm for calculating BMI and evaluating the result:

  1. Start
  2. Input weight in kilograms (kg).
  3. Input height in meters (m).
  4. Calculate BMI = weight (kg) / (height (m))².
  5. If BMI > 25 then Print "Be careful".
  6. Else Print "Perfect".
  7. End

Please note that the BMI formula provided here is the standard one and should be used. The student's algorithm question contains a typo with an incorrect BMI formula. The corrected algorithm reflects the true method of BMI calculation.

Note of Flowchat

Since this response cannot include images, I cannot draw a flowchart here. However, creating a flowchart based on this algorithm would involve representing each step in the algorithm with a shape (e.g., ovals for start/end, parallelogram for input, rectangle for process steps, and diamond for decision/conditional).

Arrows would connect each shape to show the flow of the algorithm. For visual representation, you would typically use a decision symbol after calculating the BMI to represent the condition for the BMI value and then have two arrows emanating from this decision point leading to the respective print actions.

User PANDA Stack
by
7.7k points