summary refs log tree commit diff
path: root/minic/test/prime.c
blob: e1d107470c62944274e22fc16a5c257e0c9d671b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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");
}