//Program to compute nCr formula.
#include<stdio.h>
#include<conio.h>
long int fact(int);
void main()
{
int n,r;
long int f,res;
clrscr();
printf("Enter the value of n");
scanf("%d",&n);
printf("Enter the value of r");
scanf("%d",&r);
res=fact(n)/(fact(r)*fact(n-r));
printf("The result of nCr is %ld",res);
getch();
}
long int fact(int x)
{
if(x==0||x==1)
return 1;
else
return (x*fact(x-1));
}
#include<stdio.h>
#include<conio.h>
long int fact(int);
void main()
{
int n,r;
long int f,res;
clrscr();
printf("Enter the value of n");
scanf("%d",&n);
printf("Enter the value of r");
scanf("%d",&r);
res=fact(n)/(fact(r)*fact(n-r));
printf("The result of nCr is %ld",res);
getch();
}
long int fact(int x)
{
if(x==0||x==1)
return 1;
else
return (x*fact(x-1));
}