4.输入m,n的值,求m!/(n!(n-m)!)的值。要求求阶乘由单独的函数实现。
function jiecheng(n){
var sum = 1;
for(var i=1; i<=n; i++){
sum = sum * i;
}
return sum;
var n=3,m=2;
var sum = jiecheng(m)/(jiecheng(n)*jiecheng(n-m));
document.write("m!/(n!(n-m)!)="+sum);
</script>
相关分类