#include <iostream>
using std::cout;
using std::endl;
int pow(int m, int n)
{
int result = 1;
for (int i = 1; i <= n; ++i)
{
result *= m;
}
return result;
}
int fak(int n)
{
int result = 1;
for (int i = 2; i <= n; ++i)
{
result *= i;
}
return result;
}
int binom(int n, int k)
{
return fak(n) / (fak(k) * fak(n - k));
}
int main()
{
for (int i = 1; i <= 10; ++i)
{
cout << fak(i) << ", ";
}
cout << endl;
for (int i = 0; i < 10; ++i)
{
for (int j = 0; j <= i; ++j)
{
cout << binom(i, j) << " ";
}
cout << endl;
}
return 0;
}