Happy Numbers in COBOL

The line:

PERFORM UNTIL num > 0

makes the PERFORM loop to not enter, as num is likely to be greater than 0. What you want to do is to execute the loop, getting all the digits from num UNTIL num is 0.

Besides,

MOVE pow TO addc

should be

ADD pow TO addc

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top