0
Why 10 is counted and why 0 is not in the output
static void Main(string[] args) { for (int x = 10; x > 0; x-=2) { Console.WriteLine(x);
4 Respuestas
+ 6
If you use only the sign of 'greater than' the number zero is not contemplated and therefore not shown in the for cycle
+ 5
Is
x >=0
To show you 0
not x >0
+ 2
0 is not counted because 0 is not greater than 0 in the for loop condition. if you want 0 to be counted you’d change the condition to x >= 0;
+ 1
Thanks everyone 💙