In this article we will show you, How to Write C Program to Find NCR Factorial of a Number with example. The mathematical formula behind this NCR factors is ^{n}C_{r } = n! / (r! (n-r)!)

## C Program to Find NCR Factorial of a Number

This program allows the user to enter two positive integers. And then, it will calculate the NCR Factorial of the given number

/* C Program to Find NCR Factorial of a Number */ #include <stdio.h> int Cal_Fact(int); int main() { int n, r, ncr; printf("\n Please Enter the Values for N and R: \n"); scanf("%d %d", &n, &r); ncr = Cal_Fact(n) / (Cal_Fact(r) * Cal_Fact(n-r)); printf("\n NCR Factorial of %d and %d = %d", n, r, ncr); return 0; } int Cal_Fact(int Number) { int i; int Factorial = 1; for (i = 1; i <= Number; i++) { Factorial = Factorial * i; } return Factorial; }

**OUTPUT**

As you can see from the above code snippet, we used a function called Cal_Fact to calculate the factorial of a Number. Next, we are calling that function to calculate the factorial of n, r, and n-r. I suggest you to refer Factorial of Number article to understand the factorial program

^{n}C_{r } = 6! / (2! (6-2)!) = 720/ (2 * 24) = 15

Thank you for Visiting Our Blog