add one small test

This commit is contained in:
Quentin Carbonneaux 2015-10-12 14:32:48 -04:00
parent 31b19a21b8
commit fbee480f2e
2 changed files with 39 additions and 0 deletions

27
minic/test/prime.c Normal file
View file

@ -0,0 +1,27 @@
main() {
int n;
int t;
int c;
int p;
c = 0;
n = 2;
while (n < 1000) {
if (c % 10 == 0)
if (c != 0)
printf("\n");
t = 2;
p = 1;
while (t*t <= n) {
if (n % t == 0)
p = 0;
t = t + 2;
}
if (p) {
printf("%4d ", n);
c++;
}
n = n + 2;
}
printf("\n");
}