function factorialize(num) {
if(num==0){
return 1;
}else{
for (var i = num; i >1; i--) {
num*=(i-1);
}
return num;
}
}
factorialize(5);
阶乘算法(js)
最新推荐文章于 2024-10-02 15:58:10 发布
function factorialize(num) {
if(num==0){
return 1;
}else{
for (var i = num; i >1; i--) {
num*=(i-1);
}
return num;
}
}
factorialize(5);