Baklava in Modula2

Published on 23 December 2024 (Updated: 23 December 2024)

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

Current Solution

MODULE Baklava;

FROM StrIO IMPORT WriteString, WriteLn;

PROCEDURE WriteRepeatString(s: ARRAY OF CHAR; n: CARDINAL);
VAR i: CARDINAL;
BEGIN
    FOR i := 1 TO n DO
        WriteString(s);
    END
END WriteRepeatString;

VAR
    n: INTEGER;
    numSpaces: CARDINAL;
    numStars: CARDINAL;

BEGIN
    FOR n := -10 TO 10 DO
        numSpaces := ABS(n);
        numStars := 21 - 2 * numSpaces;
        WriteRepeatString(' ', numSpaces);
        WriteRepeatString('*', numStars);
        WriteLn;
    END;
END Baklava.

Baklava in Modula2 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.