如何在asp中创建星号金字塔

时间:2016-11-16 16:40:36

标签: asp-classic

<%

For i = 1 To 10
    For j = 5 < i to 5 step -1
        response.write(" ")
    Next

    for k = 0 < i to 10
        response.write("*")
    Next

    response.write("</br>")
Next
%>

在我的代码上方使用asp经典创建星号金字塔。结果如下:

enter image description here

如何使解决方案在下面创建星号金字塔:

enter image description here

2 个答案:

答案 0 :(得分:0)

<%

For i = 1 To 10
    For j = 1 to i
        response.write(j)
    Next

    for k = 0 < i to 10
        response.write(" ")
    Next

    response.write("</br>")
Next
%>

答案 1 :(得分:0)

<%
For i = 1 To 10
    For j = 1 to i
        response.write(j)
    Next

    for k = i to 10 '<-- fill the rest of the blanks
        response.write(" ")
    Next

     response.write("</br>")
Next
%>