Use for loop to print out int value from 0 to 9 in CSharp

Description

The following code shows how to use for loop to print out int value from 0 to 9.

Example


using System;/*from w w w .ja va  2  s .c o  m*/

  public class MainClass
  {
    static void Main(string[] args)
    {
      for (int a = 0; a < 10; a++)
      {
        Console.WriteLine(a);
      }
    }
  }

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




C# Hello World
C# Operators
C# Statements
C# Exception