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
B B
C C C
D D D D
E E E E 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(i);
Next j
Print
Next i
End Sub