diff --git a/Programs/nCr.cpp b/Programs/nCr.cpp new file mode 100644 index 0000000..f3f3eee --- /dev/null +++ b/Programs/nCr.cpp @@ -0,0 +1,27 @@ +#include +#include + +using namespace std; + +int fact(int n) +{ + int f=1, i ; + for(i=n; i>=1; i--) + { + f=f*i; + } + return f; +} + + +int main() +{ + int n, r; + cout<<"Enter the value of 'n' and 'r' respectively for nCr to calculate it's factorial : "<>n>>r; + + int ans= fact(n)/(fact(r)*fact(n-r)); + cout<<"The factorial of "<