Toggle navigation
万里ACM
F.A.Qs
Web Board
ProblemSet
Source/Category
Status
Ranklist
Contest
[
ProblemSet
Status
Ranklist
OI Ranklist
Statistics
]
Login
Problem A: 使用递归函数计算阶乘
Problem A: 使用递归函数计算阶乘
Time Limit:
1 Sec
Memory Limit:
128 MB
Submit:
115
Solved:
78
[
Submit
] [
Status
] [
Web Board
] [Creator:
]
Description
阶乘的递归定义形式为
根据公式编写递归函数 int f(int n);计算n的阶乘
Input
非负整数N(N≤10)
Output
N!
Sample Input
Copy
3 5
Sample Output
Copy
6 120
HINT
用于测试函数的源程序:
#include<stdio.h>
int
main
()
{
int
n;
scanf
(
"%d"
,&n);
printf
(
"%d\n"
, f(n) );
}