| | |
Asterisk Pattern?
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
Hi everyone!
I'm new to VB.Net, and I'm having a problem with an assignment.
I have to write a program (console app) that displays four patterns of asterisks (triangles) one below the other. The first two have the square side on the left, and I got those with no problem. But the other two have the square on the right and spaces on the left. I've been working on it for two weeks and haven't had any luck. It's due tonight (I just found this site, so sorry for the crunch) the code I have so far is below.
Module modPatternDisplay
Sub Main()
Dim a, b, c1, c2, d1, d2 As Integer
Dim counterA As Integer = 1
Dim counterB As Integer = 10
Dim counterC1 As Integer = 10
Dim counterC2 As Integer
Dim counterD1 As Integer = 11
Dim counterD2 As Integer = 12
While counterA <= 10
For a = 1 To counterA
Console.Write("*")
Next
Console.WriteLine()
counterA += 1
End While
Console.WriteLine()
While counterB >= 1
For b = 1 To counterB
Console.Write("*")
Next
Console.WriteLine()
counterB -= 1
End While
Console.WriteLine()
While counterC1 >= 1
For c1 = 1 To counterC1
If counterC1 < counterC2 Then
Console.Write("*")
counterC1 -= 1
If counterC2 < counterC1 Then
Console.Write(" ")
counterC2 += 1
End If
If (counterC1 + counterC2) Mod 10 = 0 Then
Console.WriteLine()
End If
End If
Next
End While
Console.WriteLine()
Console.WriteLine()
I'm new to VB.Net, and I'm having a problem with an assignment.
I have to write a program (console app) that displays four patterns of asterisks (triangles) one below the other. The first two have the square side on the left, and I got those with no problem. But the other two have the square on the right and spaces on the left. I've been working on it for two weeks and haven't had any luck. It's due tonight (I just found this site, so sorry for the crunch) the code I have so far is below.
Module modPatternDisplay
Sub Main()
Dim a, b, c1, c2, d1, d2 As Integer
Dim counterA As Integer = 1
Dim counterB As Integer = 10
Dim counterC1 As Integer = 10
Dim counterC2 As Integer
Dim counterD1 As Integer = 11
Dim counterD2 As Integer = 12
While counterA <= 10
For a = 1 To counterA
Console.Write("*")
Next
Console.WriteLine()
counterA += 1
End While
Console.WriteLine()
While counterB >= 1
For b = 1 To counterB
Console.Write("*")
Next
Console.WriteLine()
counterB -= 1
End While
Console.WriteLine()
While counterC1 >= 1
For c1 = 1 To counterC1
If counterC1 < counterC2 Then
Console.Write("*")
counterC1 -= 1
If counterC2 < counterC1 Then
Console.Write(" ")
counterC2 += 1
End If
If (counterC1 + counterC2) Mod 10 = 0 Then
Console.WriteLine()
End If
End If
Next
End While
Console.WriteLine()
Console.WriteLine()
![]() |
Similar Threads
- Factory Design pattern implementation (C++)
- regExp pattern (Java)
- Orange LED blinks in D2 pattern - Toshiba Laptop A10-S169 (Motherboards, CPUs and RAM)
- Function for a pattern. (C)
- $5 Paypal for guessing the mathematical pattern (Geeks' Lounge)
Other Threads in the VB.NET Forum
- Previous Thread: resolution setting vb.net
- Next Thread: VB.net and Crystal Reports
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





