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

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

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

	return 0;
}