Skip to content

Commit

Permalink
punctuation, indentation and a missing fullstop? (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
axtens authored Jul 31, 2023
1 parent a168efd commit 3704b1a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions exercises/practice/armstrong-numbers/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@

PROCEDURE DIVISION.
ARMSTRONG-NUMBERS.
MOVE 0 TO WS-ARMSTRONG
PERFORM VARYING WS-INDEX FROM 1 BY 1
INITIALIZE WS-ARMSTRONG.
PERFORM VARYING WS-INDEX FROM 1 BY 1
UNTIL WS-INDEX > LENGTH(TRIM(WS-NUMBER))
IF WS-NUMBER (WS-INDEX:1) EQUAL 0
EXIT PERFORM CYCLE
END-IF
MOVE WS-NUMBER (WS-INDEX:1) TO WS-DIGIT
COMPUTE WS-ARMSTRONG =
WS-ARMSTRONG + WS-DIGIT ** LENGTH(TRIM(WS-NUMBER))
END-PERFORM.
END-PERFORM.

IF FUNCTION NUMVAL ( WS-NUMBER ) IS EQUAL TO WS-ARMSTRONG
IF FUNCTION NUMVAL ( WS-NUMBER ) IS EQUAL TO WS-ARMSTRONG
MOVE 1 TO WS-RESULT
ELSE
ELSE
MOVE 0 TO WS-RESULT
END-IF.

DISPLAY WS-ARMSTRONG.
DISPLAY WS-NUMBER.
DISPLAY WS-ARMSTRONG.
DISPLAY WS-NUMBER.

0 comments on commit 3704b1a

Please sign in to comment.