Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ThirdClass {
  4.     public static void main(String[] args) {
  5.  
  6.  
  7.         Scanner input = new Scanner(System.in);
  8.  
  9.         int factorialNum = Integer.parseInt(input.nextLine());
  10.         int divideNum = Integer.parseInt(input.nextLine());
  11.  
  12.         calculations(factorialNum,divideNum);
  13.  
  14.         }
  15.  
  16.         static void calculations (int a,int b){
  17.             int facNum = 1;                    //i*i-1 //20 * 3
  18.             for (int i = a; i >= 1; i--) { //5*4*3*2*1;
  19.                facNum = facNum*i;
  20.             }
  21.  
  22.             double divNum = (double)(facNum/b);
  23.             System.out.printf("%.2f",divNum);
  24.         }
  25.  
  26.  
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement