So, I got this non recursive version where you **do not have to compute the factorials** at all.

Code:

#include <stdio.h>
unsigned long
choose(unsigned long n, unsigned long r)/*recursive version*/
{
if( 2*r > n) r = n-r;/*c(n,r)=c(n,n-r)*/
if( (r<0) || (r>n) ) return 0;/*error*/
else if(r==0) return 1;
else if(r==1) return n;
else
{
unsigned long t;
t=choose(n-1,r-1);
return (n*t)/r;/*c(n,r)=(n*c(n-1,r-1))/r*/
}
}
unsigned long
choose1(unsigned long n, unsigned long r) /*non recursive version*/
{
unsigned long comb=1,num,den;
if( 2*r>n) r=n-r;
if( (r<0) || (r>n) ) return 0;/*error*/
for(num=n-r,den=0;num<n;num++,den++)
{
comb = ( (num+1)*comb )/(den+1);
}
return comb;
}
int
main(void)
{
unsigned long n,i;
printf("Give n\n");
scanf("%lu",&n);
printf("n=%lu\n",n);
for(i=0;i<=n;i++)
{
printf("choose(%lu,%lu)=%lu\n",n,i,choose(n,i));
printf("choose1(%lu,%lu)=%lu\n",n,i,choose1(n,i));
}
return 0;
}