Advertisement
Guest User

Untitled

a guest
Sep 24th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6.  
  7.     class Program
  8.     {
  9.         static string degree(ulong n) {
  10.             while (n % 2 == 0 & n >= 1)
  11.             {
  12.                 n = n / 2;
  13.             }
  14.             if (n == 1)
  15.             {
  16.                 return "YES";
  17.             }
  18.             else
  19.             {
  20.                 return "NO";
  21.             }
  22.  
  23.         }
  24.         static void Main()
  25.         {
  26.         ulong n;
  27.         string input = Console.ReadLine();
  28.         if (!ulong.TryParse(input, out n))
  29.         {
  30.             Console.WriteLine("wrong");
  31.         }
  32.         else {
  33.             Console.WriteLine(degree(n));
  34.         }
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement