#include<stdio.h>
#include<stdlib.h>
int main()
{
inti = 0;
intcount = 0;
for(i = 1; i <= 100; i++)
{
if(i % 10 == 0)
{
count++;
}
if(i / 10 == 9)
{
count++;
}
}
printf("count=%d", count);
system("pause");
return0;
}
本文通过C语言程序演示了如何统计1到100之间个位数为0和十位数为9的数字的数量。使用了基本的for循环和条件判断来实现这一目标。
#include<stdio.h>
#include<stdlib.h>
int main()
{
inti = 0;
intcount = 0;
for(i = 1; i <= 100; i++)
{
if(i % 10 == 0)
{
count++;
}
if(i / 10 == 9)
{
count++;
}
}
printf("count=%d", count);
system("pause");
return0;
}
1901
165

被折叠的 条评论
为什么被折叠?