Nth root of a number using log | C # implementation to find the Kth root of a number using log ; Function to find the Kth root of the number using log function ; Driver Code
using System ; 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 = 81 ; int k = 4 ; Console . Write ( " { 0 : F6 } " , kthRoot ( n , k ) ) ; } }