Advertisement
Guest User

sunglasses

a guest
Jun 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 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 Sunglasses
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.             int slash = (2 * n) - 2;
  15.             int stars = 1;
  16.             int line = n;
  17.             int spaces = n;
  18.             // first row
  19.             for (int f = 1; f <= 2 * n ; f++)
  20.             {
  21.                 Console.Write("*");
  22.             }
  23.  
  24.             for (int l = 1; l <= n; l++)
  25.             {
  26.                 Console.Write(" ");
  27.             }
  28.  
  29.             for (int f = 1; f <= 2 * n; f++)
  30.             {
  31.                 Console.Write("*");
  32.             }
  33.             Console.WriteLine();
  34.             //body
  35.             for (int i = 1; i <= n - 2; i++)
  36.             {
  37.                 if (i == (n - 1) / 2)
  38.                     Console.WriteLine("{0}{1}{0}{2}{0}{1}{0}", new string('*', stars), new string('/', slash), new string('|', line));
  39.                 else
  40.                     Console.WriteLine("{0}{1}{0}{2}{0}{1}{0}", new string('*', stars), new string('/', slash), new string(' ', spaces));
  41.  
  42.             }
  43.        
  44.             // last row
  45.             for (int f = 1; f <= 2 * n; f++)
  46.             {
  47.                 Console.Write("*");
  48.             }
  49.  
  50.             for (int l = 1; l <= n; l++)
  51.             {
  52.                 Console.Write(" ");
  53.             }
  54.  
  55.             for (int f = 1; f <= 2 * n; f++)
  56.             {
  57.                 Console.Write("*");
  58.             }
  59.             Console.WriteLine();
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement