#include <stdio.h>
int main()
{
int n=1;
int count=0;
while(n<=100)
{
if(n%10==9)
{
count++; /*个位上含数字9的*/
}
if(n-n%10==90)
{
count++; /*十位上含数字9的个数*/
}
n++;
}
printf("9出现的次数:%d\n",count);
return 0;
}
编写程序数一下 1到 100 的所有整数中出现多少次数字 9
最新推荐文章于 2018-12-29 14:25:52 发布