1844: 求阶乘
Memory Limit:32 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:14
Solved:9
Description
输入一个非负整数n(n≤12),使用while循环计算n的阶乘(n! = 1×2×3×…×n,0! = 1),输出阶乘结果。
比如输入5,5! = 120,输出120;输入0,输出1。
比如输入5,5! = 120,输出120;输入0,输出1。
Input
输入一个非负整数n(n≤12)。
Output
输出n的阶乘结果。
Sample Input Copy
5
Sample Output Copy
120
HINT
初始化阶乘变量为1,用while循环从1乘到n,注意0的阶乘是1~