#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int num, count = 1;
scanf("%d", &num);
while (num > 0)
{
num= num / 10;
if (num> 0)
count++;
}
printf("此数是%d位数", count);
}
结果如下:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int num, count = 1;
scanf("%d", &num);
while (num > 0)
{
num= num / 10;
if (num> 0)
count++;
}
printf("此数是%d位数", count);
}
结果如下: