Răspuns:
#include <iostream>
using namespace std;
int main()
{
unsigned long int a[21][21]={0};
int i,j,k,n;
cin>>n>>k;
a[0][0]=1;
for(i=1;i<=n;i++)
for(j=0;j<=i;j++)
if(j==0 || j==i) a[i][j]=1;
else a[i][j]=a[i-1][j]+a[i-1][j-1];
cout<<a[n][k];
return 0;
}
Explicație: