aboutsummaryrefslogtreecommitdiff
path: root/examples/sum-first-integers.eurm
diff options
context:
space:
mode:
authorpacien2018-04-30 23:21:17 +0200
committerpacien2018-04-30 23:21:17 +0200
commit37716a32c9aadcca83746bf96bf32b552fa55847 (patch)
tree0863035615645c376f3e7fa85d6b4b8de2354e84 /examples/sum-first-integers.eurm
parent720ffc02dc4d8614b1f8c3c31dd161984b1c6642 (diff)
downloadurm-37716a32c9aadcca83746bf96bf32b552fa55847.tar.gz
Add examples from S.V website
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