title: Check If A Number Is Power Of Another Number
signature: check_if_a_number_is_power_of_another_number <- function(x, y) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(x, y, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(x, y), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          57L, 1L, 
          TRUE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          3L, 9L, 
          TRUE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          10L, 101L, 
          FALSE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          10L, 10000L, 
          TRUE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          6L, 46656L, 
          TRUE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          2L, 2048L, 
          TRUE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          1L, 40L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          20L, 79L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          96L, 98L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          25L, 5L, 
          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 );
  }