The following is the program to find no.of possible combinations.
Programs:
//write a c program to find / check / print 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();
}
int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g--)
f=f*g;
return(f);
}
0 comments