Advertisement
koksibg

Square_Frame

Jul 8th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 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 Square_Frame
  8. {
  9.     class Square_Frame
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             if (n > 0)
  15.             {
  16.                 Console.Write("+");
  17.                 for (int i = 1; i <= n - 2; i++)
  18.                 {
  19.                     Console.Write(" -");
  20.                 }
  21.                 Console.WriteLine(" +");
  22.                 for (int j = 1; j <= n - 2; j++)
  23.                 {
  24.                     Console.Write("| ");
  25.                     for (int k = 1; k <= n - 2; k++)
  26.                     {
  27.                         Console.Write("- ");
  28.                     }
  29.                     Console.WriteLine("|");
  30.                 }
  31.                 Console.Write("+");
  32.                 for (int l = 1; l <= n - 2; l++)
  33.                 {
  34.                     Console.Write(" -");
  35.                 }
  36.                 Console.WriteLine(" +");
  37.             }
  38.             else return;
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement