计算3!+2!+1!
#include <stdio.h>
int main()
{
int i = 0;
int ret = 1;
int sum = 0;
int n = 0;
for (n = 1; n <= 3; n++)
{
ret = ret*n;
sum = sum + ret;
}
printf("sum= %d", sum);
return 0;
}
计算3!+2!+1!
#include <stdio.h>
int main()
{
int i = 0;
int ret = 1;
int sum = 0;
int n = 0;
for (n = 1; n <= 3; n++)
{
ret = ret*n;
sum = sum + ret;
}
printf("sum= %d", sum);
return 0;
}