Advertisement
plamen27

Sunglasses fixed

Aug 13th, 2016
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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. int glassesSize = int.Parse(Console.ReadLine());
  14. var a = ((2 * glassesSize - Math.Pow((-1), glassesSize) + 1) / 4);
  15. if (glassesSize >= 3 && glassesSize <= 100)
  16. {
  17. for (int currentRow = 1; currentRow < glassesSize + 1; currentRow++)
  18. {
  19. string space = string.Concat(Enumerable.Repeat(" ", glassesSize).ToArray());
  20. string asterix = string.Concat(Enumerable.Repeat("*", glassesSize * 2).ToArray());
  21. string italic = string.Concat(Enumerable.Repeat("/", 2 * glassesSize - 2).ToArray());
  22. string straight = string.Concat(Enumerable.Repeat("|", glassesSize).ToArray());
  23.  
  24.  
  25. if (currentRow == 1 || currentRow == glassesSize)
  26. {
  27. Console.WriteLine("{0}{1}{0}", asterix, space);
  28. }
  29. else
  30. {
  31. if (currentRow == a) { space = straight; }
  32. Console.WriteLine("{0}{1}{0}{2}{0}{1}{0}", "*", italic, space);
  33. }
  34. }
  35. }
  36. else
  37. {
  38.  
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement