Advertisement
YavorGrancharov

Draw_Filled_Square_(Methods)

Jun 12th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         Print(n);
  9.     }
  10.    
  11.     static void Dash(int n) {
  12.         int width = n * 2;
  13.         string dash = new string('-', width);
  14.         Console.WriteLine(dash);
  15.     }
  16.    
  17.     static void DashAndSlash(int n) {
  18.         Console.Write('-');
  19.         for (int i = 1; i < n; i++) {
  20.             Console.Write("\\/");
  21.         }
  22.         Console.WriteLine('-');
  23.     }
  24.    
  25.     static void Print(int n) {
  26.         Dash(n);
  27.         for (int i = 0; i < n - 2; i++) {
  28.             DashAndSlash(n);
  29.         }
  30.         Dash(n);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement