aboutsummaryrefslogtreecommitdiff
path: root/tests/ii/arithmetic/program.cps
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ii/arithmetic/program.cps')
-rw-r--r--tests/ii/arithmetic/program.cps18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/ii/arithmetic/program.cps b/tests/ii/arithmetic/program.cps
index 7c4bf52..e13381b 100644
--- a/tests/ii/arithmetic/program.cps
+++ b/tests/ii/arithmetic/program.cps
@@ -3,10 +3,26 @@ DECLARE Index : INTEGER
DECLARE A : INTEGER
DECLARE B : INTEGER
DECLARE Small : INTEGER
+DECLARE Sign : INTEGER
+DECLARE Band : INTEGER
INPUT Count
FOR Index <- 1 TO Count
INPUT A
INPUT B
Small <- A MOD 1000001
- OUTPUT A < B, ":", A DIV B, ":", A MOD B, ":", Small + B, ":", Small - B, ":", Small * B
+ IF A < 0 THEN
+ Sign <- -1
+ ELSE
+ IF A = 0 THEN
+ Sign <- 0
+ ELSE
+ Sign <- 1
+ ENDIF
+ ENDIF
+ CASE OF Small
+ -10 TO 10 : Band <- 2
+ 0 : Band <- 99
+ OTHERWISE : Band <- 3
+ ENDCASE
+ OUTPUT A < B, ":", A DIV B, ":", A MOD B, ":", Small + B, ":", Small - B, ":", Small * B, ":", Sign, ":", Band
NEXT Index