The first line will contain a message prompt to width of the skyscraper.
The second line will contain a message prompt to height of the skyscraper.
The succeeding lines will contain the skyscraper pattern.
Enter·width·of·skyscraper:·5
Enter·height·of·skyscraper:·10
···*
·*****
·*****
·*****
·*****
·*****
·*****
·*****
·*****
*******
class Program
{
static void Main()
{
Console.Write("Enter width of skyscraper: ");
int width = int.Parse(Console.ReadLine());
Console.Write("Enter height of skyscraper: ");
int height = int.Parse(Console.ReadLine());
for (int i = 0; i < height; i++)
{
if (i == 0)
{
Console.WriteLine(new string(' ', 3) + '*');
continue;
}
if (i == height - 1)
{
Console.WriteLine(new string('*', width + 1));
continue;
}
Console.WriteLine(' ' + new string('*', 4));
}
}
}
Comments
Leave a comment