Thought Sharing

Monday, March 23, 2009

Program in Visual Basic to generate the following pattern of alphabets:

Program in Visual Basic to generate the following pattern of stars:

A B C D E
A B C D
A B C
A B
A

Step-1 Drag and drop a command button on the form. Set its caption to ‘Print’
Step-2 Write the following code on the click event of command button

Private Sub Command1_Click()

Dim i As Integer
Dim j As Integer
For i = 69 To 65 Step -1
For j = 65 To i
Print Chr(j);
Next j
Print
Next i

End Sub