Logarithm tricks for Competitive Programming | Java implementation to find Kth root of the number ; Function to find the Kth root of the number ; Driver Code
class GFG { static double kthRoot ( double n , int k ) { return Math . pow ( k , ( 1.0 / k ) * ( Math . log ( n ) / Math . log ( k ) ) ) ; } public static void main ( String [ ] args ) { double N = 8.0 ; int K = 3 ; System . out . print ( kthRoot ( N , K ) ) ; } }