title: Write One Line C Function To Find Whether A No Is Power Of Two
signature: function write_one_line_c_function_to_find_whether_a_no_is_power_of_two(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(1, true);
      @printf("TEST-0...%s\n",result);
      
      result = driver(2, true);
      @printf("TEST-1...%s\n",result);
      
      result = driver(8, true);
      @printf("TEST-2...%s\n",result);
      
      result = driver(1024, true);
      @printf("TEST-3...%s\n",result);
      
      result = driver(24, false);
      @printf("TEST-4...%s\n",result);
      
      result = driver(7, false);
      @printf("TEST-5...%s\n",result);
      
      result = driver(46, false);
      @printf("TEST-6...%s\n",result);
      
      result = driver(61, false);
      @printf("TEST-7...%s\n",result);
      
      result = driver(73, false);
      @printf("TEST-8...%s\n",result);
      
      result = driver(66, false);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def write_one_line_c_function_to_find_whether_a_no_is_power_of_two(n):
      if (n == 0):
          return False
      while (n != 1):
          if ((n % 2) != 0):
              return False
          n = (n // 2)
      return True
source_cpp: bool write_one_line_c_function_to_find_whether_a_no_is_power_of_two(int n) {
    if ( n == 0 ) return 0;
    while ( n != 1 ) {
      if ( n % 2 != 0 ) return 0;
      n = n / 2;
    }
    return 1;
  }