Answer to Question #331875 in C# for Macky

Question #331875

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.

1
Expert's answer
2022-04-21T12:30:20-0400
using System;
using System.Text;


class Program
{
    static void Main()
    {
        Console.Write("Width of the skyscraper: ");
        int width = int.Parse(Console.ReadLine());


        Console.Write("Height of the skyscraper: ");
        int height = int.Parse(Console.ReadLine());


        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < height; i++)
            sb.Append($"{new string('*', width)}\n");


        Console.WriteLine(sb);
    }


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS