任意输入一个整数n(n在1..100000000),统计该数是几位数 提示: 用除10运算 如:123 , (1) 123/10=12 重复以上步骤,直至该数变为0为止
Posted on 2022-09-26 23:08 lachesism 阅读(220) 评论(0) 收藏 举报#include <stdio.h> main() { int t,x; t=0; scanf("%d",&x); while (x!=0) { x=x/10; t++; } printf("%d", t); }
#include <stdio.h> main() { int t,x; t=0; scanf("%d",&x); while (x!=0) { x=x/10; t++; } printf("%d", t); }