Advertisement
remote87

Draw a Filled Square

Oct 8th, 2016
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _04.DrawFilledSquare
  8. {
  9.     public class DrawFilledSquare
  10.     {
  11.         public static void Main(string[] args)
  12.         {
  13.             int howBig = int.Parse(Console.ReadLine());
  14.             PrintSquare(howBig);
  15.         }
  16.  
  17.         static void PrintHeaderRow(int n)
  18.         {
  19.             Console.WriteLine(new string('-', 2 * n));
  20.         }
  21.  
  22.         static void PrintMiddleRow(int n)
  23.         {
  24.             Console.Write('-');
  25.             for (int i = 1; i < n; i++)
  26.             {
  27.                 Console.Write("\\/");
  28.             }
  29.             Console.WriteLine('-');
  30.         }
  31.  
  32.         static void PrintSquare(int n)
  33.         {
  34.             PrintHeaderRow(n);          
  35.             PrintMiddleRow(n);
  36.             PrintMiddleRow(n);
  37.             PrintHeaderRow(n);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement