#include <iostream>
#include <cmath>
using namespace std;
int main() {
int a[10000] = {2};
int x, y, z,b;
x = 3;
y = 0;
int m, n;
cin >> m >> n;
if (m == 1) { cout << 2 << ' '; y++; }
for (int i = 1; i < n;) {
z = 1;
for (int j = 0;a[j]<=sqrt(x); j++) {
if (x%a[j] == 0) {
z = 0;
break;
}
}
if (z == 1) {
a[i] = x;
i++;
}
x++;
if (i >= m && z == 1) {
cout << a[i - 1] << ' ';
y++;
if (y % 10 == 0&&y!=n-m+1) cout << "\b" << endl;
}
}
cout << "\b";
// system("pause");
return 0;
}
关键是复制别人的代码显示全dui,好气呀……大神能帮忙看看吗?