很简单的啊,自己尽量思考一下,呵呵 # include <stdio.h>
int main() { int n, i=1; printf("请输入一个正整数:"); scanf("%d",&n); while(n >= 10) { n = n / 10; i++; } printf("你输入的值是%d位数\n",i); return 0; }