Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Pyramid
- Const Space = " " 'constant to give a space a name
- Dim NumberOfSpaces, NumberOfSymbols As Integer
- Dim MaxNumberOfSymbols As Integer
- Dim ThisSymbol As Char
- Sub InputMaxNumberOfSymbols(ByRef Number As Integer)
- Do
- Console.WriteLine("How many symbols make the base? ")
- Console.Write("Input an odd number: ")
- Number = Console.ReadLine()
- Loop Until (Number Mod 2 = 1)
- End Sub
- Sub InitialiseValues(ByRef Symbol, ByRef MaxSymbols, ByRef Spaces, ByRef Symbols)
- Console.Write("What symbol do you want to use? ")
- Symbol = Console.ReadLine()
- InputMaxNumberOfSymbols(MaxSymbols)
- Spaces = (MaxSymbols + 1) \ 2
- Symbols = 1
- End Sub
- Sub OutputChars(ByVal Number, ByVal Symbol)
- Dim Count As Integer
- For Count = 1 To Number
- Console.Write(Symbol)
- Next
- End Sub
- Sub AdjustValuesForNextRow(ByRef Spaces, ByRef Symbols)
- Spaces = Spaces - 1
- Symbols = Symbols + 2
- End Sub
- Sub Main()
- InitialiseValues(ThisSymbol, MaxNumberOfSymbols, NumberOfSpaces, NumberOfSymbols)
- Do
- OutputChars(NumberOfSpaces, Space)
- OutputChars(NumberOfSymbols, ThisSymbol)
- Console.WriteLine() 'move to new line
- AdjustValuesForNextRow(NumberOfSpaces, NumberOfSymbols)
- Loop Until NumberOfSymbols > MaxNumberOfSymbols
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment