Improve the project 4--factorial function (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.