hello everyone...I'm still learning c...I had to create a porgram to calculate the number of possible selections of choosing R players from N. I have use the facotorial function..I have done the coding..there is till one error in it..If someone could help..plzzzz
Code:
void main()
{
int n,r;
long int selection;
int factorial();
printf("\n Enter the N-number of players:");
scanf("%",&n);
printf("\n Enter the R-number of players you wish to select from %d players:",n);
scanf("%d",&r);
selection= (factorial(n))/ ((factorial(r))*(factorial(n-r)));
printf("\n The number of possible selections of %d players from %d players is %d",r,n,selection);
}
int factorial(int x)
{
if (n<1)
return(1);
else
return(n*factorial(n-1));
}