Math.Floor(Math.Log(["10進数の値"]) / Math.Log(2) + 1);
例
double digit = Math.Floor(Math.Log(27) / Math.Log(2) + 1);
Console.WriteLine(digit); //5と表示
Go to list of users who liked
More than 5 years have passed since last update.
Math.Floor(Math.Log(["10進数の値"]) / Math.Log(2) + 1);
例
double digit = Math.Floor(Math.Log(27) / Math.Log(2) + 1);
Console.WriteLine(digit); //5と表示
Register as a new user and use Qiita more conveniently
Go to list of users who liked