Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 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.         int first = Integer.parseInt(scanner.nextLine());
  8.         int second = Integer.parseInt(scanner.nextLine());
  9.  
  10.         System.out.printf("%.2f", (double) factorial(first) / factorial(second));
  11.     }
  12.  
  13.     private static int factorial(int n) {
  14.         if (n == 0)
  15.             return 1;
  16.         else
  17.             return (n * factorial(n - 1));
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement