| 1 |
*> { dg-do run } |
| 2 |
*> { dg-output {Numeric Display arithmetic(\n|\r\n|\r)} } |
| 3 |
*> { dg-output {Num1 is \+5; Num2 is \+4(\n|\r\n|\r)} } |
| 4 |
*> { dg-output {Product should be \+20, is = \+20(\n|\r\n|\r)} } |
| 5 |
*> { dg-output {Sum should be \+09, is = \+09(\n|\r\n|\r)} } |
| 6 |
*> { dg-output {Difference should be \-01, is = \-01(\n|\r\n|\r)} } |
| 7 |
*> { dg-output { (\n|\r\n|\r)} } |
| 8 |
*> { dg-output {COMP\-5 Arithmetic(\n|\r\n|\r)} } |
| 9 |
*> { dg-output {Num1_5 is \+0000000000005; Num2_5 is \+0000000000004(\n|\r\n|\r)} } |
| 10 |
*> { dg-output {Product should be \+0000000000020, is = \+0000000000020(\n|\r\n|\r)} } |
| 11 |
*> { dg-output {Sum should be \+0000000000009, is = \+0000000000009(\n|\r\n|\r)} } |
| 12 |
*> { dg-output {Difference should be \-0000000000001, is = \-0000000000001(\n|\r\n|\r)} } |
| 13 |
*> { dg-output { (\n|\r\n|\r)} } |
| 14 |
*> { dg-output {COMP\-3 Arithmetic(\n|\r\n|\r)} } |
| 15 |
*> { dg-output {Num1_3 is \+0000000000005; Num2_3 is \+0000000000004(\n|\r\n|\r)} } |
| 16 |
*> { dg-output {Product should be \+0000000000020, is = \+0000000000020(\n|\r\n|\r)} } |
| 17 |
*> { dg-output {Sum should be \+0000000000009, is = \+0000000000009(\n|\r\n|\r)} } |
| 18 |
*> { dg-output {Difference should be \-0000000000001, is = \-0000000000001(\n|\r\n|\r)} } |
| 19 |
*> { dg-output { } } |
| 20 |
IDENTIFICATION DIVISION. |
| 21 |
PROGRAM-ID. math. |
| 22 |
DATA DIVISION. |
| 23 |
WORKING-STORAGE SECTION. |
| 24 |
01 Num1 PIC S9 VALUE 5. |
| 25 |
01 Num2 PIC S9 VALUE 4. |
| 26 |
01 Result PIC S99 VALUE ZEROS. |
| 27 |
01 Num1_5 PIC S9999999999999 COMP-5 VALUE 5. |
| 28 |
01 Num2_5 PIC S9999999999999 COMP-5 VALUE 4. |
| 29 |
01 Result_5 PIC S9999999999999 COMP-5 VALUE ZEROS. |
| 30 |
01 Num1_3 PIC S9999999999999 COMP-3 VALUE 5. |
| 31 |
01 Num2_3 PIC S9999999999999 COMP-3 VALUE 4. |
| 32 |
01 Result_3 PIC S9999999999999 COMP-3 VALUE ZEROS. |
| 33 |
PROCEDURE DIVISION. |
| 34 |
DISPLAY "Numeric Display arithmetic" |
| 35 |
DISPLAY "Num1 is " Num1 "; Num2 is " Num2 |
| 36 |
MULTIPLY Num1 BY Num2 GIVING Result |
| 37 |
DISPLAY "Product should be +20, is = ", Result |
| 38 |
ADD Num1 TO Num2 GIVING Result |
| 39 |
DISPLAY "Sum should be +09, is = ", Result |
| 40 |
SUBTRACT Num1 FROM Num2 GIVING Result |
| 41 |
DISPLAY "Difference should be -01, is = ", Result |
| 42 |
DISPLAY " " |
| 43 |
DISPLAY "COMP-5 Arithmetic" |
| 44 |
DISPLAY "Num1_5 is " Num1_5 "; Num2_5 is " Num2_5 |
| 45 |
MULTIPLY Num1_5 BY Num2_5 GIVING Result_5 |
| 46 |
DISPLAY "Product should be +0000000000020, is = ", Result_5 |
| 47 |
ADD Num1_5 TO Num2_5 GIVING Result_5 |
| 48 |
DISPLAY "Sum should be +0000000000009, is = ", Result_5 |
| 49 |
SUBTRACT Num1_5 FROM Num2_5 GIVING Result_5 |
| 50 |
DISPLAY "Difference should be -0000000000001, is = ", Result_5 |
| 51 |
DISPLAY " " |
| 52 |
DISPLAY "COMP-3 Arithmetic" |
| 53 |
DISPLAY "Num1_3 is " Num1_3 "; Num2_3 is " Num2_3 |
| 54 |
MULTIPLY Num1_3 BY Num2_3 GIVING Result_3 |
| 55 |
DISPLAY "Product should be +0000000000020, is = ", Result_3 |
| 56 |
ADD Num1_3 TO Num2_3 GIVING Result_3 |
| 57 |
DISPLAY "Sum should be +0000000000009, is = ", Result_3 |
| 58 |
SUBTRACT Num1_3 FROM Num2_3 GIVING Result_3 |
| 59 |
DISPLAY "Difference should be -0000000000001, is = ", Result_3 |
| 60 |
DISPLAY " " |
| 61 |
STOP RUN. |