Thursday, September 13, 2018

Get the number of digits in a positive integer in C#!

double numberOfDigits = Math.Floor(Math.Log10(myNumber) + 1);
int betterNumberOfDigits = Convert.ToInt32(numberOfDigits);

 
 

This might be bogus honestly. I don't think I got this working yesterday.

No comments:

Post a Comment