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:

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