title: Check If A Number Is Power Of Another Number
signature: function check_if_a_number_is_power_of_another_number(x, y)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(x, y, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(x, y), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(57, 1, true);
      @printf("TEST-0...%s\n",result);
      
      result = driver(3, 9, true);
      @printf("TEST-1...%s\n",result);
      
      result = driver(10, 101, false);
      @printf("TEST-2...%s\n",result);
      
      result = driver(10, 10000, true);
      @printf("TEST-3...%s\n",result);
      
      result = driver(6, 46656, true);
      @printf("TEST-4...%s\n",result);
      
      result = driver(2, 2048, true);
      @printf("TEST-5...%s\n",result);
      
      result = driver(1, 40, false);
      @printf("TEST-6...%s\n",result);
      
      result = driver(20, 79, false);
      @printf("TEST-7...%s\n",result);
      
      result = driver(96, 98, false);
      @printf("TEST-8...%s\n",result);
      
      result = driver(25, 5, false);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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 );
  }