aboutsummaryrefslogtreecommitdiff
path: root/examples/sum-first-integers.eurm
blob: 0bfae9369fde0fcafbf100a2fcb490c922ae0e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
COMMENT Put in Register 1 the sum 1 + 2 + ... + n,
COMMENT where n is the initial value of Register 1.

COMMENT Initialization
COPY 2 1
ZERO 3

COMMENT Main loop
LABEL loop
EQ? 2 3 done
ADD 1 3
INC 3
GOTO loop

COMMENT That's all folks !
LABEL done