dabidabidesh

Factorial Division

Jun 12th, 2020
347
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //10. Factorial Division
  2. //15 EXERCISE: FUNCTIONS/10. Factorial Division.js
  3. function factorialDivision(n1, n2) {
  4.   'use strict'
  5.  
  6.   const rFact = num => {
  7.     if (num === 0) {
  8.       return 1
  9.     }
  10.     else {
  11.       return num * rFact(num - 1)
  12.     }
  13.   }
  14.  
  15.   let f1 = rFact(n1)
  16.   let f2 = rFact(n2)
  17.  
  18.   console.log((f1/f2).toFixed(2))
  19. }
RAW Paste Data