i'm trying to create a program that calculates Body mass index in a for loop with 5kg gaps. BMI formula is: weight(kg)/height(meters squared) = BMI. How would this work? this is the code i got so far:
Console.Write("Write your height in meters: ");
double t1 = double.Parse(Console.ReadLine());
Console.Clear();
Console.Write("Write starting point of weight in kg: ");
double t2 = double.Parse(Console.ReadLine());
Console.Clear();
Console.Write("Write ending point of weight in kg: ");
double t3 = double.Parse(Console.ReadLine());
Console.Clear();
double i = t1;
double t1s = t1 * t1;
double BMI = t2 / t1s;
for (i = BMI; t2 <= t3; i++)
Console.WriteLine(i);
t2 += 5;
} Console.ReadKey();
i want the result to look somewhat like this:
BMI for height 1,6m is:
weight | BMI
60 | 23.44
65 | 25.39
70 | 27.34
...skipping to 125(ending point)
125 | 48.83
i'm really lost in how this can work, if anyone knows how this could work please answer.