0

i want this result :

* * * * *
  * * * *
    * * * 
      * * 
        *

but i get this result with this code :

* * * * *
* * * *
* * * 
* * 
*
Private Sub Command1_Click()

    a = 5
    For i = 1 To 5
        For j = a To 1 Step -1
            Print " * ";
        Next j
        Print
        a = a - 1
    Next i
  
End Sub

please help! urgent!!

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by mmkhetan
0

Hi,
Add another loop for print the empty space

Private Sub Command1_Click()
Dim a As Integer, i as Integer, j as Integer, k As Integer

    a = 5
    For i = 1 To 5
        For k = 1 To i - 1
            Print "   ";
        Next

        For j = a To 1 Step -1
            Print " * ";
        Next j
        Print
        a = a - 1
    Next i
  
End Sub
0

HEREIS THE CODE
For I = 1 To 5:For J = 1 To 5
If J < I Then
Debug.Print " ";
Else
Debug.Print " *";
END IF
Next J: Debug.Print "": Next I

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.