Program to calculate Combination nCr

You can see a very clear explanation on permutation and combination on mathsisfun page.

Following is a sample implementation of nCr.

static long Combination(int n, int m)
{
      if (m > n - m) m = n - m;

      long ans = 1;

      // n!/(m!(n-m)!)
      for (int i = 0; i < m; i++) ans = ans * (n - i) / (i + 1);

      return ans;
}?