aboutsummaryrefslogtreecommitdiff
path: root/challenge-108/laurent-rosenfeld/d/ch-2.d
blob: 3d99b88f520c9761f1a333d65c098010f46b77e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import std.stdio;

void main() {
    enum MAX = 10;
    int tr[MAX][MAX];
    tr[0][0] = 1;
    int results[MAX] = 1;
    for (int row = 1; row < MAX; row++) {
        tr[row][0] = tr[row - 1][row - 1];
        results[row] = tr[row][0];
        for (int i = 1; i <= row; i++) {
            tr[row][i] = tr[row][i-1] + tr[row - 1][i-1];
        }
    }
    writeln("The first 10 Bell numbers are: ", results);
}