使用while语句求和
double factor = 1, sum = 0;
for(int i = 1; i <= 20; i++){
factor *= i;
sum += 1/factor;
}