#include<stdio.h>
#include<stdlib.h>
int main()
{
int i = 0;
int count = 0;
for (i = 1; i <= 100; i++)
{
if (i % 10 == 9)//计算个位9
{
count++;
}
if (i / 10 == 9)//计算十位9
{
count++;
}
}
printf("count = %d\n", count);
system("pause");
return 0;
}
编写程序数一下 1到 100 的所有整数中出现多少次数字9。
最新推荐文章于 2022-08-30 15:56:19 发布