9.求10!

Posted aidongshu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了9.求10!相关的知识,希望对你有一定的参考价值。

要求:求10的阶乘


#include <stdio.h>

int main(int argc, char *argv[])
{
    float a = 10,i = 2,j = 1;//用float避免溢出 
    while(i<=a)
    {
        j = j*i;
        i++;
    } 
    printf("10! = %f",j);
    return 0;
}

以上是关于9.求10!的主要内容,如果未能解决你的问题,请参考以下文章