Hello! This i my code currently. The main issue that arises is that the code will still print out -9 for some reason. I'm not too sure on why it does that because I have a module function that checks whether a number is divisible by 3 or not. I was told not to change the "if (i == 11).
{
Console.WriteLine(" FINAL BREAK REACHED! This should not happen!");
break;
}
Console.WriteLine(i++);"
part but to instead add code inside the while function to do that. My goal is for the loop should skip all divisible by 3 values and stop running when i = 10. So far it achieves this result for the other numbers expect for -9
namespace Challenge_LoopsOneAverage
{
internal class Program
{
static void Main(string[] args)
{
int i = -10;
while (true)
{
if (i % 3 == 0)
{
i++;
continue;
}
else if (i == 10)
{
break;
}
Console.WriteLine(i++);
if (i == 11)
{
Console.WriteLine(" FINAL BREAK REACHED! This should not happen!");
break;
}
Console.WriteLine(i++);
}
}
}
}