4. Even Powers of 2 (First Solution)

ivanitd

Ivan Ivanov

Posted on January 21, 2023

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
💖 💪 🙅 🚩
ivanitd
Ivan Ivanov

Posted on January 21, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

4. Even Powers of 2 (First Solution)
csharp 4. Even Powers of 2 (First Solution)

January 21, 2023

2. Numbers N...1 - (Newer Solution)
csharp 2. Numbers N...1 - (Newer Solution)

January 20, 2023