#include<stdio.h>
#include<conio.h>
long int fact(int); //function declaration
void main()
{
clrscr();
int n, r;
long int ncr, npr;
printf("Enter the value of n : ");
scanf("%d",&n);
printf("Enter the value of r : ");
scanf("%d",&r);
npr=fact(n)/fact(n-r); // calling the function or function calling
ncr=npr/fact(r); //function calling
printf("NPR value = %ld\n",npr);
printf("NCR value = %ld\n",ncr);
getch();
}
long int fact(int x) //defining the function or function definition
{
int i, f=1;
for(i=2; i<=x; i++)
{
f=f*i;
}
return f;
}
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.