BMI公式c#没有
BMI formula c# does not
请帮帮我! BMI 计算不正确!这里有什么错误。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMICHECKERARTEHOSER {
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, I'm a robot for calculating body mass index!");
Console.WriteLine("Enter your weight");
double m = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(m);
Console.WriteLine("Enter your height");
double h = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(h);
Console.WriteLine("Your bmi is:");
double i = Convert.ToDouble(m / (h * h));
Console.WriteLine(i);
}
} }
如果你希望体重是公斤,身高是厘米那么
添加到最后一行
Console.ReadKey();
和
double i = Convert.ToDouble(m / (h * h));
变化:
double i = Convert.ToDouble(m / (h * h)) * 10000; // convert to kg/m^2
请帮帮我! BMI 计算不正确!这里有什么错误。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMICHECKERARTEHOSER {
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, I'm a robot for calculating body mass index!");
Console.WriteLine("Enter your weight");
double m = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(m);
Console.WriteLine("Enter your height");
double h = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(h);
Console.WriteLine("Your bmi is:");
double i = Convert.ToDouble(m / (h * h));
Console.WriteLine(i);
}
} }
如果你希望体重是公斤,身高是厘米那么
添加到最后一行
Console.ReadKey();
和
double i = Convert.ToDouble(m / (h * h));
变化:
double i = Convert.ToDouble(m / (h * h)) * 10000; // convert to kg/m^2