Given a number N in decimal base , find number of its digits in any base ( base b ) | C # program to Find Number of digits in base b . ; function to print number of digits ; Calculating log using base changing property and then taking it floor and then adding 1. ; printing output ; Driver method ; taking inputs ; calling the method
using System ; class GFG { static void findNumberOfDigits ( long n , int b ) { int dig = ( int ) ( Math . Floor ( Math . Log ( n ) / Math . Log ( b ) ) + 1 ) ; Console . Write ( " The ▁ Number ▁ of ▁ digits " + " ▁ of ▁ Number ▁ " + n + " ▁ in ▁ base ▁ " + b + " ▁ is ▁ " + dig ) ; } public static void Main ( ) { long n = 1446 ; int b = 7 ; findNumberOfDigits ( n , b ) ; } }