文章
3
粉丝
137
获赞
2
访问
2.0k
#include<stdio.h>
int main() {
int num;
while(scanf("%d", &num) != EOF) {
double result = 1;
for (int i = 1; i <= num; i ++) {
result = result * i;
}
printf("%.0f\n", result);
}
return 0;
}
--------------------------------------------------------------------------------------------
#include<stdio.h>
double digui(double result) {
if (result > 1) {
return result * digui(result - 1);
}
return result;
}
int main() {
int num;
while(scanf("%d", &num) != EOF) {
printf("%.0f\n", digui(num));
}
return 0;
}
登录后发布评论
多组输入?
int溢出?