Untitled
unknown
plain_text
a year ago
890 B
5
Indexable
import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.Scanner; public class Main { public static Scanner cin = new Scanner(System.in); public static int factorialInt(int n) { if (n <= 1) return 1; return n * factorialInt(n - 1); } public static BigInteger factorialBigInt(BigInteger n) { if (n.equals(BigInteger.ZERO)) return BigInteger.ONE; return n.multiply(factorialBigInt(n.subtract(BigInteger.ONE))); } public static BigDecimal e(BigDecimal n) { } public static void main(String[] args) { int n; n = cin.nextInt(); System.out.println(factorialInt(n)); BigInteger n2; n2 = cin.nextBigInteger(); System.out.println(factorialBigInt(n2)); } }
Editor is loading...
Leave a Comment