ADD file via upload

李逸雯(分支)
p9xkyljec 1 year ago
parent 3da838b72c
commit 9f7815ba9a

@ -0,0 +1,18 @@
#include <stdio.h>
int factorial(int n) {
int result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
}
return result;
}
int main() {
int n;
printf("请输入一个非负整数:");
scanf("%d", &n);
printf("%d! = %d\n", n, factorial(n));
return 0;
}
Loading…
Cancel
Save