题目:已知不等式:1!+2!+…+m! < n,从键盘指定输入n值,求出满足不等式的m的整数解!
#include <stdio.h>
#include <math.h>
int main ()
{
int m,n,sum = 0,term = 1;
printf("Input n:");
scanf("%d",&n);
printf("满足不等式的m有:");
for(m = 1; sum < n;m++){
term = term * m; //累加项
sum = sum + term; //累加和
printf("%d\t",m);
}
return 0;
}