Created
October 2, 2019 23:06
-
-
Save peterthorsteinson/e39f448ec2789f0c7009b1824c42333b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class MalloyPyramid | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Enter a Number number under 100"); | |
String rowCount = Console.ReadLine(); | |
int rowNumber; | |
while (!int.TryParse(rowCount, out rowNumber)) | |
{ | |
Console.Write("Enter only whole numbers between 1 and 100.\n"); | |
rowCount = Console.ReadLine(); | |
} | |
for (int row = 0; row < rowNumber; row++) | |
{ | |
for (int column = rowNumber; column > row; column--) | |
Console.Write(" "); | |
for (int column = 0; column < (2 * row + 1); column++) | |
Console.Write("*"); | |
Console.WriteLine(); | |
} | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment