输入一个正整数n,n<=20,求n的阶层的C语言编程
时间: 2023-05-28 12:06:39 浏览: 145
#include <stdio.h>
int main()
{
int n, i;
long long factorial = 1;
printf("请输入一个正整数n:");
scanf("%d", &n);
for (i = 1; i <= n; i++) {
factorial *= i;
}
printf("%d的阶乘为%lld\n", n, factorial);
return 0;
}
阅读全文