#include <stdio.h>
void main() {
int S = 0;
int m = 1;
int i;
int N;
printf("请输入一个正整数N:\n");
scanf("%d", &N);
for (i = 1; i <= N; i++) {
m = m * i;
S = S + m;
}
printf("S=%d\n", S);
}
#include <stdio.h>
void main() {
int S = 0;
int m = 1;
int i;
int N;
printf("请输入一个正整数N:\n");
scanf("%d", &N);
for (i = 1; i <= N; i++) {
m = m * i;
S = S + m;
}
printf("S=%d\n", S);
}