Problem 20: Find the sum of the digits in the number 100!
Reused my UnsignedBigInt from Problem 16
class runner
public static void main (String[] args) throws java.lang.Exception{
long time = System.currentTimeMillis();
UnsignedBigInteger num = new UnsignedBigInteger(1);
for(int i = 100; i>0; i--){
num.multiply(i);
}
double sum = 0;
for(int i = 0; i< num.length(); i++){
sum += num.get(i);
}
System.out.println(sum);
System.out.println("time: "+(System.currentTimeMillis() - time));
}
}