import java.math.BigInteger; public class prob20 { public static void main(String args[]) { BigInteger prod = new BigInteger("1"); int sum = 0, i; for (i = 100; i > 1; i--) { prod = prod.multiply(new BigInteger("" + i)); } System.out.println("100! = " + prod.toString()); while (prod.doubleValue() > 0.5) { BigInteger m = prod.mod(new BigInteger("" + 10)); sum += m.intValue(); prod = prod.divide(new BigInteger("" + 10)); } System.out.println("Sum = " + sum); } }