summaryrefslogblamecommitdiff
path: root/src/user/app/prime/main.cpp
blob: b2b08a8c4677f968e6a4f2762f03ad165761353f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                
#include <IO/IOStream.h>

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

int Main(char** 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;
}