Pascal's triangle: Difference between revisions
Content added Content deleted
(added Fantom example) |
(Updated first two D versions) |
||
Line 386:
=={{header|D}}==
<lang d>int[][] pascalsTriangle(in int rows) pure nothrow {
auto tri = new int[][rows];
foreach (r; 0 .. rows) {
Line 399:
void main() {
assert(t == [[1],
[1, 1],
Line 414:
<lang d>import std.stdio, std.algorithm, std.range;
auto pascal(in int n) /*pure nothrow*/ {
auto p = [[1]];
foreach (_; 1 .. n)
|