整除(c++)
#include<iostream>
using namespace std;
int main()
{
int count = 1;//计数,用于控制输出格式
for (int num = 100; num <= 1000; num++) {
if (num%5 == 0 && num%6 == 0) {
if (count%10 == 0)
cout << num << endl;
else
cout << num << " ";
count++;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发