C++ program
To find permutation
By Nitesh Kumar Mehta
Code:
#include<iostream>
using namespace std;
int factorial(int n)
{
int fact=1;
for(int i=2;i<=n;i++)
fact*=i;
return fact;
}
int main()
{
int n,r;
cout << "For the calculation of nPr,Input the value of n & r:\n";
cin>>n>>r;
int ans=factorial(n)/factorial(n-r);
cout<<ans;
return 0;
}
ConversionConversion EmoticonEmoticon