解题思路:
注意事项:
参考代码:
#include
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 2; i < n; i++)
{
bool s = true;
for (int j = 2; j <i; j++)
{
if (i % j == 0 ) {
s = false; break;
}
else s = true;
}
if (s) cout << i << endl;
}
return 0;
}
0.0分
0 人评分