DEV Community

Ivan Ivanov
Ivan Ivanov

Posted on

4. Even Powers of 2 (First Solution)

using System;
using System.Diagnostics.Tracing;

namespace EvenPowersOf_2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int power =  0; power <= n; power++)
            {
                if (power % 2 == 0)
                {
                    Console.WriteLine(Math.Pow(2, power));
                }
            }


        }
    }
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)