Given two integers - n and r, your task is to calculate the
combinatorial nCr.
Implementation:
The first line - number of testcases T.
Then T lines follow, each containing two positive integers - n and r.
output
Print T lines, each line containing the value of nCr.
nCr = n! / r! (n-r)!
Implementation:
#include <stdio.h>
unsigned long long int fact(unsigned long long int n)
{
            if(n!=1)
            return n*fact(n-1);
}         
int main()
{
    unsigned long long int t,n,r,x,y,result;
    scanf("%llu",&t);
    while(t--)
    {
            scanf("%llu %llu",&n,&r);
            x=fact(r)*fact(n-r);
            y=fact(n);
            result=y/x;
            printf("%llu\n",(result%1000000007));
    }
    return 0;
}
Input
The first line - number of testcases T.
Then T lines follow, each containing two positive integers - n and r.
output
Print T lines, each line containing the value of nCr.
Sample Input
1
100 10
Sample Output
17310309456440