aboutsummaryrefslogtreecommitdiff
path: root/examples/sum-first-integers.eurm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sum-first-integers.eurm')
-rw-r--r--examples/sum-first-integers.eurm16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/sum-first-integers.eurm b/examples/sum-first-integers.eurm
new file mode 100644
index 0000000..0bfae93
--- /dev/null
+++ b/examples/sum-first-integers.eurm
@@ -0,0 +1,16 @@
1COMMENT Put in Register 1 the sum 1 + 2 + ... + n,
2COMMENT where n is the initial value of Register 1.
3
4COMMENT Initialization
5COPY 2 1
6ZERO 3
7
8COMMENT Main loop
9LABEL loop
10EQ? 2 3 done
11ADD 1 3
12INC 3
13GOTO loop
14
15COMMENT That's all folks !
16LABEL done