#include <stdio.h> int factorial(int N){ int sum=1; int i; for (i=1;i<=N;i++){ sum*=i; } return sum; } int main(){ int N; int sum=0; int i; int res; int f; res = scanf("%d",&N); if (res!=EOF){ for (i=1;i<=N;i++){ f = factorial(i); //printf("i=%d f=%d\n",i,f); sum+=f; } }else{ printf("something wrong"); } printf("%d",sum); return 0; }