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: ");
Console.Clear();

Console.Write("Write starting point of weight in kg: ");
Console.Clear();

Console.Write("Write ending point of weight in kg: ");
Console.Clear();

double i = t1;
double t1s = t1 * t1;
double BMI = t2 / t1s;

for (i = BMI; t2 <= t3; i++)

Console.WriteLine(i);
t2 += 5;

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.

I recommend using some useful names so it is easier to follow your code. Use something like "height", "startWeight", "endWeight" instead of "t1", "t2", "t3".

I suggest that you use the following form of the for loop:

``````double startWeight = 60;
double endWeight = 125;

double weight = startWeight;

for (weight = startWeight; weight <= endWeight; )
{