summaryrefslogblamecommitdiff
path: root/src/user/app/prime/main.c
blob: d3ebb7da4652c70d1be0d32c541594cc6f3eced3 (plain) (tree)


















                                                          
#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;
}