范围,出现的数字可以替换
#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;
}
原文地址:https://blog.51cto.com/14233078/2364994
时间: 2024-11-02 14:51:22