I am not good at using TEX, because I have never used it before.
However I would like you all to make an assumption Let Capital 'C' mean or [TEX]C[/TEX] mean the Combinations. Or [TEX](n!)/(n-r)! * r![/TEX]
Where '!' represents the factorial values.
So next we just take the normal
[TEX] nCr = n!/n-r!*r![/TEX]
Then now lets consider nC(r+1),
[TEX]nC(r+1)= n!/(n-(r+1))!*(r+1)![/TEX]
Now We can then derieve:
[TEX]nCr+1=n!/(n-r-1)!*(r+1)![/TEX]
So derieving more out of it. we get
[TEX]=> n!*(n-r)/(n-r)*(r+1)![/TEX]
[TEX]=>n!*(n-r)/(n-r)!*(r)!* (r+1)[/TEX]
[TEX]=>n!/(n-r)!*(r!) * n-r/(r+1)[/TEX]
Which is nothing but
[TEX]=> nCr * n-r/(r+1)[/TEX]
So what we actuall are doing in the code is that considering.
int c=1 /*let c= nC0 ==1*/
But We are using the variables.
x==n in the formula and y==r in the formula.
By that we can just derieve the value.
Because the Pascal triangle is nothing but
The Combinations [TEX]nC0 , nC1 , nC2 ................. nC(r-1), nCr[/TEX]