您的位置:首页 > 编程语言 > C语言/C++

C语言实验——求阶乘(循环结构)

2017-11-18 16:13 218 查看

C语言实验——求阶乘(循环结构)

Time Limit: 3000MS
Memory Limit: 65536KB

[align=center]SubmitStatistic[/align]

Problem Description

从键盘输入任意一个大于等于0的整数n,然后计算n的阶乘,并把它输出。
提示: 0!是 1 。

Input

输入任意一个大于等于0的整数n。

Output

输出n!

Example Input

3


Example Output

6


Hint

Author

#include<stdio.h>

int main()

{

    int n,i,mul=1;

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {

        mul=mul*i;

    }

    printf("%d",mul);

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: