#include<stdio.h>
int main() {
int n = 0;
int sum = 1;
printf("请输入一个正整数:");
scanf_s("%d", &n);
for (int i = 1; i < n+1; i++) {
sum = i * sum;
}
printf("%d的阶乘是:%d", n, sum);
return 0;
}
#include<stdio.h>
int main() {
int n = 0;
int sum = 1;
printf("请输入一个正整数:");
scanf_s("%d", &n);
for (int i = 1; i < n+1; i++) {
sum = i * sum;
}
printf("%d的阶乘是:%d", n, sum);
return 0;
}