Health Application: BMI

less than 1 minute read

The code has been modified slightly and now uploaded to the site.

Question

<— Return Home

214.cpp

#include <iostream>
#include <math.h>
using namespace std;

int main(){
   double pounds;
   double inches;
   double bmi;
   double conversion_kilograms = 0.45359237;
   double conversion_meters = 0.0254;

   std::cout << "Enter weight in pounds: \n";
   std::cin >> pounds;
   
   std::cout << "Enter height in inches: \n";
   std::cin >> inches;

   pounds *= conversion_kilograms;
   inches *= conversion_meters;
   bmi = pounds / pow(inches, 2);

   std::cout << "BMI is " << bmi;
}

<— Return Home