怎么取一个整数的位数

怎么取一个整数的位数啊 ? 例如 12345的位数为5

请先 登录 后评论

1 个回答

wale

取10为底的对数,再ceil一下,例如:

n=12345
ceil(log10(n))
请先 登录 后评论