69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <string.h>
int main(void)
{
int a = 10023;
char ch[20] = { '\0' };
printf("%d\n", sprintf(ch, "%d", a));
return 0;
}
while (precision-- > 0 || number != 0) {
digit = (int)(number % radix) + '0';
number /= radix; /* reduce number */
if (digit > '9') {
/* a hex digit, make it a letter */
digit += hexadd;
}
*text.sz-- = (char)digit; /* store the digit */
}
#include <stdio.h>
#include <string.h>
int main(void)
{
int a = 10023;
char ch[20] = { '\0' };
sprintf(ch, "%d", a);
printf("%d\n", strlen(ch));
return 0;
}
#include "stdio.h"
void main()
{
int a = 1234;
int iCount = 0;
while (a)
{
a/=10;
iCount++;
}
printf("%d\n", iCount);
}
static UINT s[] = {10,100,1000,1000 * 10,1000* 100, 1000 * 1000, 1000*1000*10,1000*1000*100,1000*1000*1000, -1};
UINT u = abs(i);
for(int j = 0; u >= s[j]; j ++);
int n = j + 1;
//当i是正数时
int n = log10(i);
n += (int)pow(10, n) <= i;