Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool CreateRectangle(string widthString)
- {
- int width = Int32.Parse(widthString);
- for(int y = 0; y < width; y++)
- {
- for (int x = 0; x < width; x++)
- {
- if (y == width - 1)
- Console.Write("*");
- else if (x == 0 && y != width - 1)
- Console.Write("*");
- else if (x == y && y != width - 1)
- Console.Write("*");
- else if (x != y && x != 0 && y != width - 1)
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement