计算n的阶乘,n可输入
// 5 != 5 * 4 * 3 * 2 * 1 * 1;
// 4 != 4 * 3 * 2 * 1;
var n = parseInt(window.prompt('请输入n的值:'));
var mul = 1;
for (var i = 1; i <= n; i++) {
mul *= i;
}
document.write(mul);
来源:CSDN
作者:Eli-sun
链接:https://blog.csdn.net/vfjcgg/article/details/104572446