A C program to find the value of ncr
#include<stdio.h>
#include<conio.h>
int fact(int x);
void main()
{
int n,r,ncr;
clrscr();
printf("\nEnter the value of N and R\n");
scanf("%d%d",&n,&r); p
ncr=fact(n)/(fact(r)*fact(n-r));
printf("\nOur answer is:: %d",ncr);
getch();
}
int fact(int x)
{
int f=1,i;
if(x==0)
{
return(f);
}
else
{
for(i=1;i<=x;i++)
{
f=f*i;
}
return(f);
}
}
|