|
Practice Exercise 4 Looping |
![]() |
Write a program that prints the following patterns separately on the form each time a button is pressed. Provide four buttons A, B, C and D. When button A is pressed, the triangle shown in part (A) is printed, etc. Use For/Next loops to generate the patterns. Each triangle's asterisks (*) should be printed by a single statement; (this causes the asterisks to print side by side). A vbCrLf (vb Carriage Return/Line Feed) will move the cursor to the next line. Use a label to display your output. Hints: The last two patterns require that each line begin with an appropriate number of blanks. You can use the Space(someNum) to generate a String containing spaces. The value passed to Space specifies the number of spaces to create. Use nested For/Next structures and minimize the number of output statements.
Here is a demo if you need it. Here is an example of a possible interface.
|