C Program to find no. of combinations - c programs
//C Program to find no. of combinations
//C Program to find no. of combinations
#include <stdio.h>
#include <conio.h>
main()
{
int n,c,r;
clrscr();
printf("enter values of n amd r");
scanf("%d%d",&n,&r);
c=fact(n)/(fact(r)*Fact(n-r));
printf("No, of combinations of n and r ",c);
getch();
}
#include <conio.h>
main()
{
int n,c,r;
clrscr();
printf("enter values of n amd r");
scanf("%d%d",&n,&r);
c=fact(n)/(fact(r)*Fact(n-r));
printf("No, of combinations of n and r ",c);
getch();
}
int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g--)
f=f*g;
return(f);
}
{
int f,g;
f=1;
for(g=a;g>0;g--)
f=f*g;
return(f);
}
No comments:
Post a Comment