#include<stdio.h>
#include<stdlib.h>
int main(){
int count=0;
for (int i = 1; i < 101; i++){
if (i % 10 == 9){ //判断个位数为9
count++;
}
if (i / 10 == 9){ //判断十位数为9
count++;
}
}
printf("一共含有%d个9\n", count);
system("pause");
return 0;
}
It appeared integer from 1 to 100, how many times 9
Guess you like
Origin blog.csdn.net/sun_105/article/details/92783053
Recommended
Ranking