范围,出现的数字可以替换
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,y,m;
int sum = 0;//计数器
for (n = 1; n <= 100; n++)
{
m = n;//把n赋值给m
while (m > 0)
{
y = m % 10;
m = m / 10;
if (y == 9)
sum++;
}
}
printf("%d",sum);
return 0;
}