Advertisement
desislava_topuzakova

4. Четни степени на 2 -> начин 1

Nov 27th, 2021
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Even_powers_of_2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             //четни степени от 0 до n
  12.             //начало: 0
  13.             //край: n
  14.             //повтаряме: печатаме 2 на степен
  15.             //промяна: + 1
  16.             for (int step = 0; step <= n; step++)
  17.             {
  18.                 if (step % 2 == 0)
  19.                 {
  20.                     Console.WriteLine(Math.Pow(2, step));
  21.                 }    
  22.             }
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement