I'm trying to make a BMI Calculator (using meters and kilograms) in C#, but, when i type in 1.92m and 80Kg (or any other values), it gives me some weird results, like 0,0021701388888888888888888889.
namespace BMI
{
internal class Program
{
static void Main(string[] args)
{
decimal height = Convert.ToDecimal(Console.ReadLine()); //1.92m
decimal weight = Convert.ToDecimal(Console.ReadLine()); //80Kg
decimal BMI = weight / (height*height);
Console.WriteLine(BMI);// Result: 0,0021701388888888888888888889
}
}
}
Isn't it supposed to give me the value of 21.7013888889 without those zeros ? What am i doing wrong ? I am a complete beginner and i have no idea how to fix this.