Skip to content

Commit da8f2fc

Browse files
committed
factorial
1 parent d75fac5 commit da8f2fc

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Programs/DSA/factorial.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@ function factorial(num) {
1818
return num * factorial(num - 1)
1919
}
2020
}
21-
console.log(factorial(5))//120
21+
22+
function printfactorial(n){
23+
for(let i=1;i<=n;i++){
24+
console.log(i +"=",factorial(i))
25+
}
26+
27+
}
28+
29+
printfactorial(5)//120
30+
31+

0 commit comments

Comments
 (0)