Subprogram pentru combinări
#include<iostream>
using namespace std;
int comb(int n, int k)
{int i,a=1,b=1,c=1;
for(i=1;i<=n;i++)
a=a*i;
for(i=1;i<=k;i++)
b=b*i;
for(i=1;i<=n-k;i++)
c=c*i;
return a/(b*c);
}
int main()
{int n,k;
cout<<"Combinari de ";cin>>n;
cout<<"Luate cate ";cin>>k;
cout<<comb(n,k);
}