Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. package SoftUni_Java_Fundamentals;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FactorialDivision {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. int a = Integer.parseInt(scanner.nextLine());
  9. int b = Integer.parseInt(scanner.nextLine());
  10. DivideFactorials(a,b);
  11. }
  12.  
  13. private static void DivideFactorials(int a, int b) {
  14. int factoriel1 = 1;
  15. int factoriel2 = 1;
  16. for (int i = 1; i <= a; i++) {
  17. factoriel1*=i;
  18. }
  19. for (int i = 1; i <= b; i++) {
  20. factoriel2*=i;
  21. }
  22. double division = factoriel1/factoriel2;
  23. System.out.printf("%.2f",division);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement