Skip to content

Instantly share code, notes, and snippets.

@jaclync
Created August 31, 2018 02:26
Show Gist options
  • Save jaclync/7e2c2aef5999661770cf087ee9c3bba8 to your computer and use it in GitHub Desktop.
Save jaclync/7e2c2aef5999661770cf087ee9c3bba8 to your computer and use it in GitHub Desktop.
Working version
import java.util.Scanner;
import java.math.*;
public class NMul {
public static void main(String[] args) {
BigInteger sum;
long n;
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
n = sc.nextLong();
sum = BigInteger.valueOf(1);
for (long i = 1; i <= n; i++) {
sum = sum.multiply(BigInteger.valueOf(i));
}
System.out.println(sum);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment