summaryrefslogtreecommitdiff
path: root/src/user/app/prime/main.c
blob: d3ebb7da4652c70d1be0d32c541594cc6f3eced3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

int is_prime(int i) {
	int j;
	for (j = 2; j*j <= i; j++) {
		if (i % j == 0) return 0;
	}
	return 1;
}

int main(char **args) {
	int i;
	for (i = 2; i < 1000000; i++) {
		if (is_prime(i)) printf("%d\t", i);
	}
	printf("\nThat's all prime numbers for today.\n");

	return 0;
}