CSharp – for Statement

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number = 5;
 
            for(int i = 0; i < number; i++)
                Console.WriteLine(i);
 
            // the console will close if you press Return on the keyboard
            Console.ReadLine();
        }
    }
}

The result is:
0
1
2
3
4