title: K Th Digit Raised Power B
signature: function k_th_digit_raised_power_b(a, b, k)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return math.abs(actual - expected) < 1e-09
  end
  
  function driver(a, b, k, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(a, b, k) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(11, 2, 1, 1.0)
      print(string.format("TEST-0...%s",result))
  
      result = driver(41, 3, 3, 9.210000000000036)
      print(string.format("TEST-1...%s",result))
  
      result = driver(5, 4, 3, 6.25)
      print(string.format("TEST-2...%s",result))
  
      result = driver(1, 2, 4, 0.001)
      print(string.format("TEST-3...%s",result))
  
      result = driver(5, 2, 3, 0.25)
      print(string.format("TEST-4...%s",result))
  
      result = driver(66, 5, 8, 5.233257599999973)
      print(string.format("TEST-5...%s",result))
  
      result = driver(7, 10, 3, 2.489999999757856)
      print(string.format("TEST-6...%s",result))
  
      result = driver(77, 30, 10, 4.0)
      print(string.format("TEST-7...%s",result))
  
      result = driver(60, 50, 1, 0.0)
      print(string.format("TEST-8...%s",result))
  
  end
  
  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;
  }