title: K Th Digit Raised Power B
signature: k_th_digit_raised_power_b <- function(a, b, k) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      abs(actual - expected) < 1e-09
  }
  
  driver <- function(a, b, k, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b, k), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          11L, 2L, 1L, 
          1.0
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          41L, 3L, 3L, 
          9.210000000000036
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          5L, 4L, 3L, 
          6.25
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          1L, 2L, 4L, 
          0.001
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          5L, 2L, 3L, 
          0.25
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          66L, 5L, 8L, 
          5.233257599999973
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          7L, 10L, 3L, 
          2.489999999757856
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          77L, 30L, 10L, 
          4.0
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          60L, 50L, 1L, 
          0.0
      )))
  
  }
  
  main()
source_py: def k_th_digit_raised_power_b(a, b, k):
      p = (a ** b)
      count = 0
      while ((p > 0) and (count < k)):
          rem = (p % 10)
          count = (count + 1)
          if (count == k):
              return rem
          p = (p / 10)
source_cpp: int k_th_digit_raised_power_b(int a, int b, int k) {
    int p = pow ( a, b );
    int count = 0;
    while ( p > 0 && count < k ) {
      int rem = p % 10;
      count ++;
      if ( count == k ) return rem;
      p = p / 10;
    }
    return 0;
  }