提交时间:2023-11-13 21:10:16

运行 ID: 31055

#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 2; i <= n; ++ i) { bool f = true; for (int j = 2; j < i; ++ j) { if (i % j == 0) f = false; } if (f == true) cout << i << '\n'; } return 0; }