Pascal's triangle: Difference between revisions
Content added Content deleted
Adamwhitehat (talk | contribs) (→{{header|C sharp|C#}}: Added arbitrarily large (BigInteger) implementation in C#) |
|||
Line 3,093: | Line 3,093: | ||
1 6 15 20 15 6 1 |
1 6 15 20 15 6 1 |
||
</pre> |
</pre> |
||
=={{header|Modula-2}}== |
|||
<lang modula2>MODULE Pascal; |
|||
FROM FormatString IMPORT FormatString; |
|||
FROM Terminal IMPORT WriteString,WriteLn,ReadChar; |
|||
PROCEDURE PrintLine(n : INTEGER); |
|||
VAR |
|||
buf : ARRAY[0..63] OF CHAR; |
|||
m,j : INTEGER; |
|||
BEGIN |
|||
IF n<1 THEN RETURN END; |
|||
m := 1; |
|||
WriteString("1 "); |
|||
FOR j:=1 TO n-1 DO |
|||
m := m * (n - j) DIV j; |
|||
FormatString("%i ", buf, m); |
|||
WriteString(buf) |
|||
END; |
|||
WriteLn |
|||
END PrintLine; |
|||
PROCEDURE Print(n : INTEGER); |
|||
VAR i : INTEGER; |
|||
BEGIN |
|||
FOR i:=1 TO n DO |
|||
PrintLine(i) |
|||
END |
|||
END Print; |
|||
BEGIN |
|||
Print(10); |
|||
ReadChar |
|||
END Pascal.</lang> |
|||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |