#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main() {
int count = 0;
int i = 0;
for (i = 1; i <= 100; i++) {//个位
if (i % 10 == 9)
count++;
}
for (i = 1; i <= 100; i++) {//十位
if (i / 10 == 9)
count++;
}
printf(“1-100有%d个9\n”, count);
system(“pause”);
return 0;
}
编写程序数一下 1到 100 的所有整数中出现多少次数字9
最新推荐文章于 2022-05-17 16:41:41 发布