Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / I am having trouble creating a program in Visual Basic that prints the * in a diamond shape

I am having trouble creating a program in Visual Basic that prints the * in a diamond shape

Computer Science

I am having trouble creating a program in Visual Basic that prints the * in a diamond shape. Do you have any suggestions?

This is what I have so far. It is an un-proportioned diamond, I need a normal diamond. What am I doing wrong?

Dim i As Integer
Dim y As Integer
Dim j As Integer

For i = -9 To 9
y = System.Math.Abs(i)
y = (y * (-1)) + 10

Console.WriteLine("")
For j = 1 To y
Console.Write("*")
Next

i += 1
Next

Any help is greatly appreciated.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

------------------------------------------------------

Dim i As Integer
Dim y As Integer
Dim j As Integer
Dim s As Integer

For i = -9 To 9
y = System.Math.Abs(i)
y = (y * (-1)) + 10

Console.WriteLine("")
For s = 1 To (9 - y) / 2
Console.Write(" ")
Next
For j = 1 To y
Console.Write("*")
Next

i += 1
Next

----------------------------------------