summary refs log tree commit diff
path: root/minic/test/prime.c
blob: 182cb3df303ff9c90b9ebc1127d29514d0887da9 (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) {
		t = 2;
		p = 1;
		while (t*t <= n) {
			if (n % t == 0)
				p = 0;
			t = t + 2;
		}
		if (p) {
			if (c % 10 == 0)
			if (c != 0)
				printf("\n");
			printf("%4d ", n);
			c++;
		}
		n++;
	}
	printf("\n");
}