summary refs log tree commit diff
path: root/minic
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-13 18:15:04 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-13 18:15:04 -0500
commit916555cb10110f6c748e70cb5337752432a325b8 (patch)
treef4394b06f25e4a95d5f3c418195b1e25a334283b /minic
parent52fad575802e99c34f93e03ba91ca34dd1d547b7 (diff)
downloadroux-916555cb10110f6c748e70cb5337752432a325b8.tar.gz
add new test by Andrew Chambers
Diffstat (limited to 'minic')
-rw-r--r--minic/test/euler9.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/minic/test/euler9.c b/minic/test/euler9.c
new file mode 100644
index 0000000..ec85b86
--- /dev/null
+++ b/minic/test/euler9.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+
+main()
+{
+	int i;
+	int a;
+	int b;
+	int c;
+	int d;
+	
+	for (a = 1; a < 1000; a++) {
+		for (b = a + 1; b < 1000; b++) {
+			d = a*a + b*b;
+			for (i = 0; i < 1000; i++) {
+				if (i * i == d) {
+					c = i;
+					if (b < c && a+b+c == 1000) {
+						printf("%d\n", a*b*c);
+						return 0;
+					}
+					break;
+				}
+			}
+		}
+	}
+}
+