#include<stdio.h>
#include<conio.h>
long fact(long);
main()
{
long n,r,ncr;
clrscr();
printf("Enter number(n): ");
scanf("%ld",&n);
printf("\nEnter number(r): ");
scanf("%ld",&r);
if(n>r)
{
ncr=(fact(n)/fact(n-r))/fact(r);
printf("\nnCr is %ld",ncr);
getch();
}
else
{
printf("\nIt is not possible");
getch();
}
}
long fact(long x)
{
long temp;
for(temp=x-1;temp>=1;temp--)
{
x=x*temp;
}
return x;
}
#include<conio.h>
long fact(long);
main()
{
long n,r,ncr;
clrscr();
printf("Enter number(n): ");
scanf("%ld",&n);
printf("\nEnter number(r): ");
scanf("%ld",&r);
if(n>r)
{
ncr=(fact(n)/fact(n-r))/fact(r);
printf("\nnCr is %ld",ncr);
getch();
}
else
{
printf("\nIt is not possible");
getch();
}
}
long fact(long x)
{
long temp;
for(temp=x-1;temp>=1;temp--)
{
x=x*temp;
}
return x;
}