mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-04 14:21:55 +03:00
2f54c7de00
git-svn-id: svn://kolibrios.org@8097 a494cfbc-eb01-0410-851d-a64ba20cac60
52 lines
908 B
Plaintext
52 lines
908 B
Plaintext
(*
|
|
adapted to Oberon-07 by 0CodErr, KolibriOS team
|
|
*)
|
|
(*
|
|
Produce a formatted NxN multiplication table
|
|
Only print the top half triangle of products
|
|
*)
|
|
|
|
MODULE MultiplicationTables;
|
|
|
|
IMPORT In, Out, Console;
|
|
|
|
|
|
CONST
|
|
N = 18;
|
|
|
|
|
|
VAR
|
|
I, J: INTEGER;
|
|
|
|
|
|
BEGIN
|
|
Console.open;
|
|
|
|
FOR J := 1 TO N - 1 DO
|
|
Out.Int(J, 3);
|
|
Out.String(" ")
|
|
END;
|
|
Out.Int(N, 3);
|
|
Out.Ln;
|
|
FOR J := 0 TO N - 1 DO
|
|
Out.String("----")
|
|
END;
|
|
Out.String("+");
|
|
Out.Ln;
|
|
FOR I := 1 TO N DO
|
|
FOR J := 1 TO N DO
|
|
IF J < I THEN
|
|
Out.String(" ")
|
|
ELSE
|
|
Out.Int(I * J, 3);
|
|
Out.String(" ")
|
|
END
|
|
END;
|
|
Out.String("| ");
|
|
Out.Int(I, 2);
|
|
Out.Ln
|
|
END;
|
|
In.Ln;
|
|
|
|
Console.exit(TRUE)
|
|
END MultiplicationTables. |