Please help me with the task: "Output all numbers"

Hello, I’m working on this task:

Write a program that outputs all numbers from 0(including) to 99(including) to the screen, each on a new line.

Here is my code:


namespace OutputAllNumbers
{
   class PasswordHack
   {
       static void Main(string[] args)
       {
           for(int i = 0; i < 99; i++)
           {
               Console.WriteLine(i);
           }
              
       }
   }
}


Can anyone please help me to solve it?

Your code is almost correct, you just have to replace < to <=, for(int i = 0; i <= 99; i++)

namespace OutputAllNumbers
{
class PasswordHack
{
static void Main(string[] args)
{
for(int i = 0; i <= 99; i++)
{
Console.WriteLine(i);
}

   }

}
}

1 Like