#include<stdio.h> int main(void) { int n, len ; printf ( "输入一个数:" ) ; scanf ( "%d%n", &n, &len ) ; printf ( "这是一个%d位数。\n", len ) ; return 0; }
#include<stdio.h> #include<math.h> int main() { int n; scanf("%d",&n); printf("%d",(int)log10(n)+1); return 0; }