Liczby parzyste

Liczby parzyste

Program: wypisujący wszystkie liczby parzyste.

Począwszy od liczby podanej przez użytkownika (max 20) do 0. W przykładzie od liczby “5”.

Kompilator: Microsoft Visual Studio

Galeria:

Program w akcji.

Kod programu:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Podaj i (od - do 20):");
            int n = int.Parse(Console.ReadLine());
            for (int i = n; i <= 20; i++)
            {
                if (i % 2 == 0)
                    Console.WriteLine(i);
            };
            Console.ReadKey();
            Console.Clear();
        }
    }
}