title: Check If A Number Is Power Of Another Number
signature: function checkIfANumberIsPowerOfAnotherNumber($x, $y) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($x, $y, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($x, $y), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        57, 1, 
        true));
      
      printf("TEST-1...%s\n",driver(
        3, 9, 
        true));
      
      printf("TEST-2...%s\n",driver(
        10, 101, 
        false));
      
      printf("TEST-3...%s\n",driver(
        10, 10000, 
        true));
      
      printf("TEST-4...%s\n",driver(
        6, 46656, 
        true));
      
      printf("TEST-5...%s\n",driver(
        2, 2048, 
        true));
      
      printf("TEST-6...%s\n",driver(
        1, 40, 
        false));
      
      printf("TEST-7...%s\n",driver(
        20, 79, 
        false));
      
      printf("TEST-8...%s\n",driver(
        96, 98, 
        false));
      
      printf("TEST-9...%s\n",driver(
        25, 5, 
        false));
      
  }
  
  main();
  ?>
source_py: def check_if_a_number_is_power_of_another_number(x, y):
      if (x == 1):
          return (y == 1)
      pow = 1
      while (pow < y):
          pow = (pow * x)
      return (pow == y)
source_cpp: bool check_if_a_number_is_power_of_another_number(int x, long int y) {
    if ( x == 1 ) return ( y == 1 );
    long int pow = 1;
    while ( pow < y ) pow *= x;
    return ( pow == y );
  }