Tasks and codes
/**copyright (c) 2016,CSDN College *all rights reserved.* file name: lzz.c* Creator: Linzeze * Completion Date: May 8, 2016 * version number: v1.0* problem Description: Compile a program, enter values for M and n , the number of combinations is obtained. It is required to define the function of the factorial and the combination, and the function of the combination number to find the function of the factorial to realize the solution, in the main () function, the function of the input and output and call the combination number * Program input: * Program output: */#include <stdio.h > #include <stdlib.h>long FAC (int); int Main () { int m,n; printf ("Please enter values for M and N:"); scanf ("%d%d", &m,&n); if (m>=n) { printf ("Combined number C (m,n) is:%d", FAC (m)/(FAC (n) *FAC (m-n)));} } Long FAC (int n) //is used to find the factorial of n { int i; Long S=1; for (i=1;i<=n;i++) { s*=i; } return s;}
Run results
Improve the project 4--factorial function (2)