用inputbox输入行数,第一排1个数字,第二排3个,第三排5个...以此类推。数字是1-9轮流显示,输出的是等腰三角形,每个数字间有两个空格。
1
2 3 4
5 6 7 8 9
1 2 3 4 5 6 7
8 9 1 2 3 4 5 6 7
..............................
vb输出数字等腰三角形
答案:1 悬赏:40 手机版
解决时间 2021-12-29 03:37
- 提问者网友:雾里闻花香
- 2021-12-28 06:11
最佳答案
- 五星知识达人网友:野味小生
- 2021-12-28 07:14
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script type="text/javascript">
function output()
{
var result;
var lines;
var digit;
result = "";
lines = document.getElementById("lines").value;
digit = 1;
for (i=1; i<=lines; i++)
{
for (j=1; j<=(lines-i); j++)
{
result = result + ' '+ ' '+ ' ';
}
for (j=1; j <=(2*i-1); j++)
{
if (digit == 10)
{
digit = 1
}
result = result + (digit++)+ ' '+ ' ';
}
result = result + "<br/>";
}
document.getElementById("result").innerHTML = result;
}
</script>
</HEAD>
<BO...<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script type="text/javascript">
function output()
{
var result;
var lines;
var digit;
result = "";
lines = document.getElementById("lines").value;
digit = 1;
for (i=1; i<=lines; i++)
{
for (j=1; j<=(lines-i); j++)
{
result = result + ' '+ ' '+ ' ';
}
for (j=1; j <=(2*i-1); j++)
{
if (digit == 10)
{
digit = 1
}
result = result + (digit++)+ ' '+ ' ';
}
result = result + "<br/>";
}
document.getElementById("result").innerHTML = result;
}
</script>
</HEAD>
<BODY>
Lines: <input type="text" id="lines" name="lines"/><input type="button" id="enter" name="Enter" value="Enter" onclick="output()"/>
<br/>
<div id="result">
</div>
</BODY>
</HTML>
<HTML>
<HEAD>
<script type="text/javascript">
function output()
{
var result;
var lines;
var digit;
result = "";
lines = document.getElementById("lines").value;
digit = 1;
for (i=1; i<=lines; i++)
{
for (j=1; j<=(lines-i); j++)
{
result = result + ' '+ ' '+ ' ';
}
for (j=1; j <=(2*i-1); j++)
{
if (digit == 10)
{
digit = 1
}
result = result + (digit++)+ ' '+ ' ';
}
result = result + "<br/>";
}
document.getElementById("result").innerHTML = result;
}
</script>
</HEAD>
<BO...<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script type="text/javascript">
function output()
{
var result;
var lines;
var digit;
result = "";
lines = document.getElementById("lines").value;
digit = 1;
for (i=1; i<=lines; i++)
{
for (j=1; j<=(lines-i); j++)
{
result = result + ' '+ ' '+ ' ';
}
for (j=1; j <=(2*i-1); j++)
{
if (digit == 10)
{
digit = 1
}
result = result + (digit++)+ ' '+ ' ';
}
result = result + "<br/>";
}
document.getElementById("result").innerHTML = result;
}
</script>
</HEAD>
<BODY>
Lines: <input type="text" id="lines" name="lines"/><input type="button" id="enter" name="Enter" value="Enter" onclick="output()"/>
<br/>
<div id="result">
</div>
</BODY>
</HTML>
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯