aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/backend
diff options
Diffstat (limited to 'validation/backend')
-rw-r--r--validation/backend/sum.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/backend/sum.c b/validation/backend/sum.c
new file mode 100644
index 00000000..c9451d4b
--- /dev/null
+++ b/validation/backend/sum.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+static int sum(int n)
+{
+ int i, result = 0;
+
+ for (i = 1; i <= n; ++i)
+ result += i;
+ return result;
+}
+
+int main(int argc, char **argv)
+{
+ printf("%d\n", sum(5));
+ printf("%d\n", sum(100));
+ return 0;
+}
+
+/*
+ * check-name: sum from 1 to n
+ * check-command: ./sparsei $file
+ *
+ * check-output-start
+15
+5050
+ * check-output-end
+ */