{}
BLACK NOVEMBER
Get 66% off PRO
Are you struggling to build your coding confidence or land your first job?
Fast-track to your first pay-check.
Start PRO
Start PRO
BLACK NOVEMBER
Get 66% off PRO
Are you struggling to build your coding confidence or land your first job?
Fast-track to your first pay-check.
Start PRO
Start PRO
run-icon
Main.cs
using System; public class HelloWorld { public static void Main(string[] args) { double height, weight, BMI; string sex, BMIrate; Console.WriteLine("What is your sex ('M' or 'F')"); sex = Convert.ToString(Console.ReadLine()); Console.WriteLine("How tall are you in meters?"); height = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("How many kilograms do you weigh?"); weight = Convert.ToDouble(Console.ReadLine()); BMI = weight/(height*height); Console.WriteLine("Your BMI is " + BMI); if (BMI < 18.5) { BMIrate = "underweight."; } else if (BMI < 24.9) { BMIrate = "normal weight."; } else if (BMI < 29.9) { BMIrate = "overweight."; } else if (BMI < 39.9) { BMIrate = "obese."; } else { BMIrate = "severely obese."; } Console.WriteLine("This is considered " + BMIrate); } }
Output