From fbee480f2ed31616583cef5735df07e694ff9c5c Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 12 Oct 2015 14:32:48 -0400 Subject: add one small test --- minic/test/prime.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 minic/test/prime.c (limited to 'minic/test') diff --git a/minic/test/prime.c b/minic/test/prime.c new file mode 100644 index 0000000..e1d1074 --- /dev/null +++ b/minic/test/prime.c @@ -0,0 +1,27 @@ +main() { + int n; + int t; + int c; + int p; + + c = 0; + n = 2; + while (n < 1000) { + if (c % 10 == 0) + if (c != 0) + printf("\n"); + t = 2; + p = 1; + while (t*t <= n) { + if (n % t == 0) + p = 0; + t = t + 2; + } + if (p) { + printf("%4d ", n); + c++; + } + n = n + 2; + } + printf("\n"); +} -- cgit 1.4.1