Advertisement
Guest User

FactorialDivision

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