Visual C# (Body Mass Index Calculator) (Console) The formulas for calculating th
ID: 3589665 • Letter: V
Question
Visual C# (Body Mass Index Calculator) (Console) The formulas for calculating the BMI is: BMI = weightInPounds x 703 / heightInInches x heightInInches Create a BMI calculator app that reads the user's weight in pounds and height in inches, then calculates and displays the user's body mass index. The app should also display the following information from the Department of Health and Human Services so the user can evaluate his/her BMI: BMI VALUES Underweight: less than 18.5 Normal: between 18.5 and 24.9 Overweight: between 25 and 29.9 Obese: 30 or greater
Explanation / Answer
using System;
public class Test
{
public static void Main()
{
//input weight and height
Console.WriteLine("Enter the user weight in pounds and height in inches : ");
double weightInPounds = Convert.ToDouble(Console.ReadLine());
double heightInInches = Convert.ToDouble(Console.ReadLine());
double BMI = weightInPounds * 703 / (heightInInches * heightInInches); //calculate BMI
Console.WriteLine(" BMI = "+BMI);
if(BMI < 18.5)
Console.WriteLine(" Normal");
else if(BMI >= 18.5 && BMI <=24.9)
Console.WriteLine(" Overweight");
else if(BMI >= 25 && BMI <=29.9)
Console.WriteLine(" Obese");
}
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.