Learn
Variables
Review

You made it to the end of the lesson! High five. 🙌

Here is a review of the lesson:

  • A variable represents a particular piece of your computer’s memory that has been set aside for you to use to store, retrieve, and manipulate data.
  • C++ basic data types include:
    • int: integers
    • double: floating-point numbers
    • char: individual characters
    • string: sequence of characters
    • bool: true/false
  • Single equal sign = indicates assignment, not equality in the mathematical sense.
  • cin is how to receive input from the user.

Instructions

1.

Optional: The body mass index (BMI) is commonly used by health and nutrition professionals to estimate human body fat in populations.

It is computed by taking the individual’s weight in kilograms (kg) and dividing it by the square of their height in meters (m²):

bmi=weightheight2bmi = \frac{weight}{height^2}

Complete the bmi.cpp program.

(You can also just run the code as is to move on.)

Folder Icon

Take this course for free

Already have an account?