You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
368 B
28 lines
368 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
#define MAX 1000
|
|
int is_sushu(int n) {
|
|
int i, mid;
|
|
mid=(int)sqrt(n);
|
|
for(i=2; i<=mid; i++)
|
|
if(0 == n%i)
|
|
return 0;
|
|
return 1;
|
|
}
|
|
int main() {
|
|
int i, count;
|
|
count=0;
|
|
for(i=2; i<=MAX; i++)
|
|
if(is_sushu(i)) {
|
|
count++;
|
|
printf("%5d", i);
|
|
if(0 == count%10)
|
|
printf("\n");
|
|
}
|
|
printf("\n");
|
|
return 0;
|
|
}
|
|
|
|
|