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 alphabets:
A
A B
A B C
A B C D
A B C D E
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 = 65 To 69 Step 1
For j = 65 To i
Print Chr(j);
Next j
Print
Next i

End Sub