summary refs log tree commit diff
path: root/minic/test
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-12 14:32:48 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-12 14:32:48 -0400
commitfbee480f2ed31616583cef5735df07e694ff9c5c (patch)
tree56a9b34786be21512925fd52a8a2e9502a8bb45b /minic/test
parent31b19a21b8ac2a8ce67864794af88241df7674a6 (diff)
downloadroux-fbee480f2ed31616583cef5735df07e694ff9c5c.tar.gz
add one small test
Diffstat (limited to 'minic/test')
-rw-r--r--minic/test/prime.c27
1 files changed, 27 insertions, 0 deletions
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");
+}