#include <iostream>
using namespace std;
int divisor (int n)
{
int i = 2;
while (i <=n) {
if (n % i == 0)
return i;
i++;
}
return n;
}
int main(){
int n = 2, j = 0;
while (n <=1000){
if (divisor(n) == n ) {
j++;
cout << n <<" ";
if(j%7==0)
{
cout<<endl;
}
}
n++;
}
cout << j << endl;
system("pause");
return 0;
}
댓글 없음:
댓글 쓰기