Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Exc8FactorialDivision {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int first = Integer.parseInt(scanner.nextLine());
- int second = Integer.parseInt(scanner.nextLine());
- long firstFactorial = getFactorialResult(first);
- long secondFactorial = getFactorialResult(second);
- System.out.printf("%.2f",(firstFactorial*1.0 / secondFactorial));
- }
- private static long getFactorialResult(int n) {
- long factorial = 1;
- for (int i = 1; i <= n; i++) {
- factorial = factorial * i;
- }
- return factorial;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement