编写程序数一下1到100的所有整数中出现多少次数字9
#include <stdio.h>
int main()
{
int m;
int n;
int p;
int count=0;
for(m=1;m<100;m++)
{
n=m/10;
p=m%10;
if(n==9) //注意是等于不是赋值<img src="http://img.blog.csdn.net/20150322153510727?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvWmhvbmdRaTA4MDg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
{
count++;
}
if(p==9)
{
count++;
}
}
printf("%d",count);
return 0;
}