C program to find / check / print no. of combinations

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);
}
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...
 
Posts RSSComments RSSBack to top
© 2013 Updated Tech News Results and Reviews