forked from KolibriOS/kolibrios
2f54c7de00
git-svn-id: svn://kolibrios.org@8097 a494cfbc-eb01-0410-851d-a64ba20cac60
44 lines
815 B
Plaintext
44 lines
815 B
Plaintext
(*
|
|
adapted to Oberon-07 by 0CodErr, KolibriOS team
|
|
*)
|
|
MODULE SierpinskiTriangle;
|
|
|
|
IMPORT In, Out, Console;
|
|
|
|
|
|
VAR
|
|
order: INTEGER;
|
|
|
|
|
|
PROCEDURE PrintSierpinski(order: INTEGER);
|
|
VAR
|
|
x, y, k, size: INTEGER;
|
|
|
|
BEGIN
|
|
size := LSL(1, order) - 1;
|
|
FOR y := size TO 0 BY -1 DO
|
|
FOR k := 1 TO y DO
|
|
Out.Char(" ")
|
|
END;
|
|
FOR x := 0 TO size - y DO
|
|
IF BITS(x) * BITS(y) = {} THEN
|
|
Out.String("* ")
|
|
ELSE
|
|
Out.String(" ")
|
|
END
|
|
END;
|
|
Out.Ln
|
|
END
|
|
END PrintSierpinski;
|
|
|
|
|
|
BEGIN
|
|
Console.open;
|
|
|
|
Out.String("Input triangle order(0..5):");
|
|
In.Int(order);
|
|
PrintSierpinski(order);
|
|
In.Ln;
|
|
|
|
Console.exit(TRUE)
|
|
END SierpinskiTriangle. |