+ 1
Is it possible to have this Kind of FOR LOOP. I ran this cide byt it is not giving me any result
using System; namespace Project { class MyClass { public static void Main(string[] args) { for (int i = 5; i <= 1; i--) { Console.WriteLine(i); } } } }
4 odpowiedzi
+ 5
There is a problem with your syntax
for(int i=5; i >=1; i--)
If i is greater than 1, then you have a True statement & your code will continue.
But 5 is not smaller than 1, so you have a false condition, loop stops
+ 2
Hello, it seems you made an error in your logic. You set i = 5. In the next step, you say 5 <= 1. Do you see the logical error?
0
*code *but
0
Thanks I've seen the error