package wzs.arithmetics;
//题目:求1+2!+3!+...+20!的和
public class Test_wzs20
{
public static void main(String[] args)
{
long temp = 1;
long sum = 0;
for (int i = 1; i <= 20; i++)
{
temp = temp * i;
sum += temp;
}
System.out.println("sum=" + sum);
}
}
输出结果:
sum=2561327494111820313