Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleRectangle
- {
- public class Program
- {
- private static void Main()
- {
- {
- const int width = 30;
- const int height = 15;
- const char symbol = '▓';
- Console.WriteLine();
- Enumerable.Range(0, 15).SelectMany(row => Enumerable.Range(0, 30), (row, col) => new { row, col }).Where(@t => @t.col == 0 || @t.col == 30 || @t.row == 0 || @t.row == 15).Select(x => x); // test wip
- var totalRows = 0;
- var totalCols = 0;
- for (var y = 0; y <= height - 1; y++)
- {
- totalRows++;
- for (var x = 0; x <= width - 1; x++)
- {
- if (x != 0 && x != width - 1 && y != 0 && y != height - 1)
- Console.ForegroundColor = ConsoleColor.Yellow;
- else
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Write(symbol);
- totalCols++;
- }
- Console.WriteLine("");
- }
- Console.WriteLine($"Total rows = {totalRows}, total cols = {totalCols / 15}");
- Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement