无标题文章

include

include

using namespace std;

bool isPrime(int n)
{
bool isprime = true;

if ( n == 2 ) isprime = true;
return isprime;

}

int main()
{
int m, n;
cin >> m >> n;
int num = 2, cnt = 0, ctl = 0;
for ( ; cnt < n ; num+=2) {
if ( isPrime(num) ) {
cout << num;
if ( ctl < 10 ) {
cout << " ";
ctl++;
}
else {
ctl = 0;
cout << endl;
}
}

}
return 0;

}

你可能感兴趣的:(无标题文章)