#include<stdio.h>intcount9(int i);intmain(){int i =1;int sum =0;for(i; i <=100; i++){//取得每一位的数字,判断,如果为9加一,否则就跳出循环
sum +=count9(i);//调用函数}printf("%d",sum);return0;}intcount9(int i){int j =0;int k =0;int count =0;do{
j = i %10;//对10进行取模,取得最低位的数字,整除去掉最低位if(j ==9){
count++;}
i = i /10;}while(i);return count;}