Respuesta :

Answer:

// here is code in C++(bmi.cpp).

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

float weight,height;

cout<<"enter the weight(in kilograms):";

//read the weight

cin>>weight;

cout<<"enter the height(in meters):";

//read the height

cin>>height;

// calculate the bmi

float bmi=weight/(pow(height,2));

// print the body-mass index with two decimal places

cout<<"BMI is: "<<fixed<<setprecision(2)<<bmi<<endl;

return 0;

}

Explanation:

Read the weight from user and assign it to variable "weight",read height and assign it to variable "height".Then find the body-mass index as (weight/height^2).Here weight  should be in kilograms and height should be in meters.

Output:

enter the weight(in kilograms):75

enter the height(in meters):1.8

BMI is: 23.15