#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int n,r,ncr;
clrscr();
printf("\n enter n and r:");
scanf("%d%d",&n,&r);
ncr=fact(n)/(fact(n-r)*fact(r));
printf("\n Binomial co-efficient : %d",ncr);
getch();
}
int fact(int x)
{
if(x==0)
return 1;
else
return(x*fact(x-1));
}
#include<conio.h>
int fact(int);
void main()
{
int n,r,ncr;
clrscr();
printf("\n enter n and r:");
scanf("%d%d",&n,&r);
ncr=fact(n)/(fact(n-r)*fact(r));
printf("\n Binomial co-efficient : %d",ncr);
getch();
}
int fact(int x)
{
if(x==0)
return 1;
else
return(x*fact(x-1));
}
it's not return any value accept 0
ReplyDelete