Advertisement
Guest User

Untitled

a guest
Aug 13th, 2016
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 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 ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.            
  15.            
  16.                 for(int i =0;i<n;i++)
  17.                 {
  18.                     if(i==0||i==n-1)
  19.                     {
  20.                         PrintTopAndBottomPart(n);
  21.                     }
  22.        
  23.                     else
  24.                     {
  25.                         PrintMiddlePart(n, i);
  26.                     }
  27.                 }
  28.  
  29.            
  30.         }
  31.         static void PrintTopAndBottomPart(int n)
  32.         {
  33.             string topAndBottom = new string('*', 2*n);
  34.             string emptySpace = new string(' ', n);
  35.             Console.WriteLine("{0}{1}{0}",topAndBottom,emptySpace);      
  36.         }
  37.        static void PrintMiddlePart(int n, int i)
  38.         {
  39.             string Lens = new string('/', 2 * n - 2);
  40.             string middleframe = string.Format("{0}{1}{0}", "*", Lens);
  41.             string Bridge = new string(' ', n);
  42.             if(i==n/2)
  43.             {
  44.                 Bridge = new string('|',n);
  45.             }
  46.            Console.WriteLine("{0}{1}{0}",middleframe,Bridge);
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement