#include <stdio.h>
int main(){
int a =0,sum =0;
printf("请输入数字:");
scanf("%d",&a);
while (a!=0)
{
a /= 10;
sum ++;
}
printf("是%d位数\n",sum);
return 0;
}
#include <stdio.h>
int main(){
int a =0,sum =0;
printf("请输入数字:");
scanf("%d",&a);
while (a!=0)
{
a /= 10;
sum ++;
}
printf("是%d位数\n",sum);
return 0;
}
本文标题:C 语言实例28 - 判断数字为几位数
本文链接:https://www.haomeiwen.com/subject/gbncqdtx.html
网友评论