编写程序数一下1到100的所有整数中出现多少次数字9

#include <stdio.h>
#include <stdlib.h>
void main()
{
	int i, count=0;
	for (i=1;i<=100;i++)
	{
		if (i%10==9||i/10==9)
		count += 1;
	}
	printf("%d\n",count);
	system("pause");
}

猜你喜欢

转载自blog.csdn.net/qq_43765564/article/details/84727330