package homewordk1;
import java.math.*;
public Factorial {
public static void main(String args[]){
BigInteger fact=new BigInteger("1"),sum=new BigInteger("0");
int i=1;
do{
fact=fact.multiply(new BigInteger(i+""));
sum=sum.add(fact);
++i;
}while(i<=100);
System.out.println(sum.toString());
}
}
Java大数类BigInteger的应用:计算1到100的阶乘和
猜你喜欢
转载自blog.csdn.net/RealCoder/article/details/108629755
今日推荐
周排行