Baklava in Cobol

Published on 17 January 2025 (Updated: 17 January 2025)

Welcome to the Baklava in Cobol page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

        IDENTIFICATION DIVISION.
        PROGRAM-ID. BAKLAVA.
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  NUM             PIC 9(2).
            01  NUM-SPACES      PIC 9(2).
            01  NUM-STARS       PIC 9(2).
            01  BAKLAVA-SPACES  PIC X(10) VALUE SPACES.
            01  BAKLAVA-STARS   PIC X(21) VALUE ALL "*".

        PROCEDURE DIVISION.
            PERFORM VARYING NUM FROM 0 BY 1 UNTIL NUM > 20
                COMPUTE NUM-SPACES = FUNCTION ABS(NUM - 10)
                COMPUTE NUM-STARS = 21 - 2 * NUM-SPACES

      * Display NUM-SPACES " " without newline
                DISPLAY BAKLAVA-SPACES(1:NUM-SPACES) NO ADVANCING

      * Display NUM-STARS "*" with newline
                DISPLAY BAKLAVA-STARS(1:NUM-STARS)
            END-PERFORM
            STOP RUN.

Baklava in Cobol was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.