Write+a+program+to+find+all+prime+numbers+between+100+and+200.C++
时间: 2023-12-08 12:04:44 浏览: 112
以下是C++语言的程序,用于查找100到200之间的所有质数:
```c++
#include <iostream>
using namespace std;
int main() {
int i, j;
bool isPrime;
cout << "Prime numbers between 100 and 200 are: " << endl;
for (i = 100; i <= 200; i++) {
isPrime = true;
for (j = 2; j <= i / 2; j++) {
if (i % j == 0) {
isPrime = false;
break;
}
}
if (isPrime) {
cout << i << " ";
}
}
return 0;
}
```
阅读全文