Advertisement
IvanBorisovG

butterfly

Aug 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. int n = int.Parse(Console.ReadLine());
  2.  
  3.             string topRowsLabel = "{0}\\ /{0}";
  4.             int symbolCount = n - 2;
  5.  
  6.             for (int i = 0; i < symbolCount; i++)
  7.             {
  8.                 string row = string.Empty;
  9.  
  10.                 if (i % 2 == 0)
  11.                 {
  12.                     row = string.Format(topRowsLabel, new string('*', symbolCount));
  13.                 }
  14.                 else
  15.                 {
  16.                     row = string.Format(topRowsLabel, new string('-', symbolCount));
  17.                 }
  18.  
  19.                 Console.WriteLine(row);
  20.             }
  21.  
  22.             Console.WriteLine(new string(' ', n - 1) + "@");
  23.  
  24.             string botRowsLabel = "{0}/ \\{0}";
  25.  
  26.             for (int i = 0; i < symbolCount; i++)
  27.             {
  28.                 string row = string.Empty;
  29.  
  30.                 if (i % 2 == 0)
  31.                 {
  32.                     row = string.Format(botRowsLabel, new string('*', symbolCount));
  33.                 }
  34.                 else
  35.                 {
  36.                     row = string.Format(botRowsLabel, new string('-', symbolCount));
  37.                 }
  38.  
  39.                 Console.WriteLine(row);
  40.             }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement