miroslavbstoyanov

Untitled

Feb 25th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 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 Demo
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14.  
  15. string firstLastRow = string.Format("{0}{1}{0}", new string('-', 4 * n / 2), new string('*', n));
  16.  
  17. Console.WriteLine(firstLastRow);
  18.  
  19. int ampersand = n + 2;
  20. for (int i = 1; i <= n / 2; i++)
  21. {
  22. Console.WriteLine("{0}{1}{2}{1}{0}", new string('-', (5 * n - (ampersand + i * 2)) / 2),
  23. new string('*', i),
  24. new string('&', ampersand));
  25. ampersand += 2;
  26.  
  27. }
  28.  
  29. for (int i = 1; i <= n / 2; i++)
  30. {
  31. Console.WriteLine("{0}**{1}**{0}", new string('-', n - i),
  32. new string('~', n * 5 - ((n - i) * 2 + 4)));
  33. }
  34.  
  35. Console.WriteLine("{0}*{1}*{0}", new string('-', n / 2),
  36. new string('|', 5 * n - ((n / 2 * 2) + 2)));
  37.  
  38. for (int i = n / 2; i > 0; i--)
  39. {
  40. Console.WriteLine("{0}**{1}**{0}", new string('-', n - i),
  41. new string('~', n * 5 - ((n - i) * 2 + 4)));
  42. }
  43.  
  44. for (int i = n / 2; i > 0; i--)
  45. {
  46. ampersand -= 2;
  47. Console.WriteLine("{0}{1}{2}{1}{0}", new string('-', (5 * n - (ampersand + i * 2)) / 2),
  48. new string('*', i),
  49. new string('&', ampersand));
  50. }
  51. Console.WriteLine(firstLastRow);
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment