Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(n,n1){
- let solution = factorial(n) / factorial(n1);
- console.log(solution.toFixed(2))
- function factorial(num){
- if(num < 0){
- return -1;
- }
- else if(num === 0){
- return 1;
- }else{
- return (num * factorial(num -1));
- }
- }
- }
- solve(5,2);
Advertisement
Add Comment
Please, Sign In to add comment