title: Write One Line C Function To Find Whether A No Is Power Of Two
signature: function writeOneLineCFunctionToFindWhetherANoIsPowerOfTwo(n: number): boolean {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(1, true);
    console.log(`TEST-0...${result}`);
  
    result = driver(2, true);
    console.log(`TEST-1...${result}`);
  
    result = driver(8, true);
    console.log(`TEST-2...${result}`);
  
    result = driver(1024, true);
    console.log(`TEST-3...${result}`);
  
    result = driver(24, false);
    console.log(`TEST-4...${result}`);
  
    result = driver(7, false);
    console.log(`TEST-5...${result}`);
  
    result = driver(46, false);
    console.log(`TEST-6...${result}`);
  
    result = driver(61, false);
    console.log(`TEST-7...${result}`);
  
    result = driver(73, false);
    console.log(`TEST-8...${result}`);
  
    result = driver(66, false);
    console.log(`TEST-9...${result}`);
  
  };
  
  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;
  }