#include<stdio.h>
#include<math.h>
int fact(int a)
{
int i,fact=1;
for(i=1;i<=a;i++)
{
fact=fact*i;
}
return fact;
}
int main()
{
int n,r;
float permu,combi;
printf("Enter the value of n: \n");
scanf("%d",&n);
printf("Enter the vlaue of r: \n");
scanf("%d",&r);
permu= fact(n)/fact(n-r);
combi=fact(n)/(fact(n-r)*fact(r));
printf("The permutation nPr: %.2f\n",permu);
printf("THe combination nCr: %.2f\n",combi);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: