<html>
<head>
<meta charset="utf-8">
</head>
<body>
</body>
<script>
var 显示="";
var a=prompt("输入一个数字");
var n=prompt("输入次数");
var sum=0;
var sum1="得到的数字:";
for(var j=0;j<n;j++){
var 叠加=a;
for(var i=0;i<j;i++)叠加+=a;
sum1+=叠加+",";
sum+=叠加*1;
}
显示+=sum1+"<br />";
显示+="结果是:"+sum;
document.body.innerHTML=显示;
</script>
</html>
<head>
<meta charset="utf-8">
</head>
<body>
</body>
<script>
var 显示="";
var a=prompt("输入一个数字");
var n=prompt("输入次数");
var sum=0;
var sum1="得到的数字:";
for(var j=0;j<n;j++){
var 叠加=a;
for(var i=0;i<j;i++)叠加+=a;
sum1+=叠加+",";
sum+=叠加*1;
}
显示+=sum1+"<br />";
显示+="结果是:"+sum;
document.body.innerHTML=显示;
</script>
</html>