编写程序数一下 1到 100 的所有整数中出现多少次数字9
发布时间:2023-01-07 02:20:50 271
相关标签:
#define _CRT_SECURE_NO_WARNINGS 1
#include
#include
#include
#include
#include
int main()
{
int ret = 0;
int count = 0;
for(ret = 1; ret <= 100; ret++)
{
if(ret % 10 == 9)
{
printf("%d\n",ret);
count++;
}
if(ret / 10 == 9)
{
printf("%d\n",ret);
count++;
}
}
printf("\n9的个数count=%d\n",count);
system("pause");
return 0;
}
文章来源: https://blog.51cto.com/u_13668714/5980751
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报