Asterisk Pattern?

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 1
Reputation: maddogjbm is an unknown quantity at this point 
Solved Threads: 0
maddogjbm maddogjbm is offline Offline
Newbie Poster

Asterisk Pattern?

 
0
  #1
Oct 15th, 2006
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()
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC