标签:else pre can mat int ret 非递归 turn print
#include<stdio.h>
#include<math.h>
int main()
{
int n;
int sum = 1;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
sum *= i;
}
printf("%d", sum);
return 0;
} //非递归
#include<stdio.h>
int floor(int n)
{
if (n == 1)
{
return 1;
}
else
{
return floor(n-1)*n;
}
}
int main()
{
int n;
int ret;
scanf("%d", &n);
ret = floor(n);
printf("%d", ret);
return 0;
}
标签:else pre can mat int ret 非递归 turn print
原文地址:https://blog.51cto.com/14737345/2479827