Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
1,590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FactorialDivision {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         long first = Integer.parseInt(scanner.nextLine());
  8.         long second = Integer.parseInt(scanner.nextLine());
  9.         double rezult = factorial(first) / factorial(second);
  10.  
  11.         System.out.printf("%.2f", rezult);
  12.     }
  13.  
  14.     private static long factorial(long n) {
  15.         if (n == 0)
  16.             return 1;
  17.         else
  18.             return (n * factorial(n - 1));
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement