aboutsummaryrefslogtreecommitdiff
path: root/challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m3
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m3')
-rw-r--r--challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m320
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m3 b/challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m3
new file mode 100644
index 0000000000..5983b8e9ae
--- /dev/null
+++ b/challenge-252/deadmarshal/modula-3/ch2/src/Ch2.m3
@@ -0,0 +1,20 @@
+MODULE Ch2 EXPORTS Main;
+
+IMPORT SIO;
+
+PROCEDURE UniqueSumZero(READONLY N:INTEGER) =
+ BEGIN
+ FOR I := 1 TO N DIV 2 DO
+ SIO.PutInt(I);
+ SIO.PutChar(' ');
+ SIO.PutInt(-I);
+ SIO.PutChar(' ')
+ END;
+ IF N MOD 2 = 1 THEN SIO.PutInt(0); SIO.Nl() END
+ END UniqueSumZero;
+
+BEGIN
+ UniqueSumZero(5);
+ UniqueSumZero(3);
+ UniqueSumZero(1);
+END Ch2.