This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
microgentambly/examples/primes.mga

36 lines
439 B
Plaintext

INT i
INT j
INT n
INT c
INT modr
IN INT n Enter the number till which you want prime numbers\n
OUT Prime numbers are:\n
SET i 2
:loopi
SET c 0
SET j 1
:loopj
MOD i j modr
JE increasec modr 0
:increasecback
INC j 1
JLE loopj j i
JE printn c 2
:printback
INC i 1
JLE loopi i n
END
:increasec
INC c 1
JMP increasecback
:printn
OUT $i$\n
JMP printback