CSharp - Write program to output every numbers

Requirements

You will display "every other" number until 20.

Hint

You can augment the number variable by 2 in for loop, the corresponding statement will be number += 2.

Demo

using System;
class Program// w  w  w . j  a  va2s.  c  o  m
{
    static void Main(string[] args)
    {
        // Output 
        for (int number = 2; number <= 20; number += 2)
        {
            Console.WriteLine(number);
        }
    }
}

Result

Alternative Solution

You can have an ordinary loop from 1 to 10 stepping by 1 and display twice the amount of its control variable rather than the variable itself.

Demo

using System;
class Program//from   ww w. j av a  2 s  .  com
{
    static void Main(string[] args)
    {
        // Output 
        for (int line = 1; line <= 10; line++)
        {
            int displayedNumber = 2 * line;
            Console.WriteLine(displayedNumber);
        }
    }
}

Result