用do-while语句求1至1000之间满足 "用3除余2;且用5除余3"的数,且一行只打印五个数
时间: 2023-05-28 21:05:08 浏览: 88
JS实现1000以内被3或5整除的数字之和
int i = 1;
int count = 0;
do {
if(i % 3 == 2 && i % 5 == 3) {
cout << i << " ";
count++;
if(count % 5 == 0) {
cout << endl;
}
}
i++;
} while(i <= 1000);
阅读全文