Problem: Write a program that prints the following diamond shape. You may use output statements that print a single asterisk (*), a single space or a single carriage return. Maximize your use of repetition (with nested For … Next statements) and minimize the number of output statements.
*
***
*****
*******
*********
*******
*****
***
*
(Diamond Shape)
_________________________________________________________
I think I need 3 nested for loops.
Here is my pseudocode:
For each line
For number of spaces required at beginning of line
write space
Next
For number of stars on line
write star
Next
write new line
Next
_________________________________________________________
I am totally new to programming and this is my firs program. I am having trouble converting my pseudocode into VB .NET code using "For ... Next" Repetition Statements.
I can use Console.WriteLine("*****") but I need to use repetition statements inorder to minimize the number of output statements.
My updated code is this:
Module ForCounter
Sub Main()
Dim i As Integer
Dim j As Integer
For i = 0 To 3
Console.Write("*")
Next
For j = 0 To 5
Console.WriteLine("*")
Next
End Sub ' Main
End Module
Which results in this:
*****
*
*
*
*
*
Clearly not a diamond
How to write three nested For ... Next loops? I am kind of lost here
Please HELP!!!