不用for,while,那用do…whileZ总可以吧
int fac = 1; int i = 1; int n; scanf("%d",&n); do { fac = fac * i; ++i; } while (i <= n);