Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
25
Task/Pascals-triangle/Modula-3/pascals-triangle.mod3
Normal file
25
Task/Pascals-triangle/Modula-3/pascals-triangle.mod3
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
MODULE Main;
|
||||
|
||||
IMPORT SIO,Fmt;
|
||||
|
||||
PROCEDURE PrintLine(READONLY N:INTEGER) =
|
||||
VAR M:INTEGER;
|
||||
BEGIN
|
||||
IF N < 1 THEN RETURN END;
|
||||
M := 1;
|
||||
SIO.PutText("1 ");
|
||||
FOR I := 1 TO N-1 DO
|
||||
M := M * (N-I) DIV I;
|
||||
SIO.PutText(Fmt.F("%s ",Fmt.Int(M)))
|
||||
END;
|
||||
SIO.Nl()
|
||||
END PrintLine;
|
||||
|
||||
PROCEDURE Print(READONLY N:INTEGER) =
|
||||
BEGIN
|
||||
FOR I := 1 TO N DO PrintLine(I) END;
|
||||
END Print;
|
||||
|
||||
BEGIN
|
||||
Print(10)
|
||||
END Main.
|
||||
Loading…
Add table
Add a link
Reference in a new issue