#include <stdio.h>
int main()
{
int i = 0;
int a;
for (a = 1; a <= 100; a++)
{
if (a % 10 == 9)
i++;
if (a / 10 == 9)
i++;
}
printf("1到100的所有整数中出现%d个数字9。", i);
system("pause");
return 0;
}
编写程序数一下1到100的所有整数中出现多少个数字9。
最新推荐文章于 2023-01-15 11:05:11 发布