范围,出现的数字可以替换
#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;
}
标签:10,编写程序,int,sum,includeint,数一下,100,数字
来源: https://blog.51cto.com/14233078/2364994