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!!

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

thanks alot for the explanation.
your help is much apprciated! :)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.