int main()
{
int i = 0;
int count = 0;
for (i = 1; i <= 100; i++)
{
if (i % 3 == 0)
{
printf("%d ", i);
count++;
}
}
printf("\nconut=%d\n", count);
return 0;
}
运行结果

解法二
```
int main()
{
int a = 1;
int count = 0;
while (a <= 100)
{
if (a % 3 == 0)
{
printf("%d ", a);
a++;
count++;
}
else
a++;
}
printf("\nconut=%d\n", count);
return 0;
}
运行结果

原文:https://blog.51cto.com/14950896/2545747