BubaLazi

Draw a Filled Square

Jul 7th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 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.  
  8.  
  9. namespace ConsoleApp1
  10. {
  11.     class Program
  12.     {
  13.  
  14.  
  15.         static void Main(string[] args)
  16.         {
  17.             int n = int.Parse(Console.ReadLine());
  18.  
  19.             PrintHeaderRow(n);
  20.             for (int i = 0; i < n - 2; i++)
  21.             {                
  22.                 PrintMiddleRow(n);
  23.             }
  24.             PrintHeaderRow(n);
  25.         }
  26.        
  27.         static void PrintHeaderRow(int n)
  28.         {
  29.             Console.WriteLine(new string('-', n * 2));
  30.         }
  31.  
  32.         static void PrintMiddleRow(int n)
  33.         {
  34.             Console.Write("-");
  35.             for (int i=0; i <(( n * 2)-2)/2; i++)
  36.             {
  37.                 Console.Write("\\/");
  38.                                
  39.             }
  40.             Console.WriteLine("-");
  41.         }
  42.  
  43.        
  44.     }
  45. }
Add Comment
Please, Sign In to add comment