Advertisement
IrinaIgnatova

Big Factorial

Jul 5th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4. import java.math.BigInteger;
  5. import java.util.*;
  6.  
  7. public class Main {
  8.  
  9.     public static void main(String[] args) {
  10.         Scanner scanner = new Scanner(System.in);
  11.  
  12.         int n = scanner.nextInt();
  13.         BigInteger f = new BigInteger(String.valueOf(1));
  14.  
  15.         for (int i = 1; i <= n; i++) {
  16.             f = f.multiply(BigInteger.valueOf(i));
  17.  
  18.  
  19.         }
  20.         System.out.println(f);
  21.  
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement