       IDENTIFICATION DIVISION.
       PROGRAM-ID. EULER-SET-1 IS INITIAL.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       01  E BINARY-LONG.
       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
            CALL 'EULER-1' USING 10 RETURNING E.
            DISPLAY "Euler example: " E.
            CALL 'EULER-1' USING 1000 RETURNING E.
            DISPLAY "Euler solution: " E.
            STOP RUN.
       END PROGRAM EULER-SET-1.


       IDENTIFICATION DIVISION.
       PROGRAM-ID. EULER-1.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  RESULT BINARY-LONG.
       01  I BINARY-LONG.
       01  REM BINARY-LONG.
       LINKAGE SECTION.
       01  N BINARY-LONG.
       PROCEDURE DIVISION USING N.
           MOVE 0 TO RESULT.
           PERFORM VARYING I FROM 0 BY 1 UNTIL I = N
               IF FUNCTION MOD(I, 3) = 0 OR FUNCTION MOD(I, 5) = 0 THEN
                   ADD I TO RESULT
               END-IF
           END-PERFORM.
           GOBACK RETURNING RESULT.
       END PROGRAM EULER-1.
