Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 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 Practice_2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14.  
  15. int stars = n % 2 == 0 ? 2 : 1;
  16. int size = (n % 2 == 0) ? n / 2 : n / 2 + 1;
  17. int dashes = (n % 2 == 0) ? n / 2 - 1 : n / 2;
  18.  
  19. for (int i = 0; i < size; i++)
  20. {
  21. Console.Write(new string('-', dashes));
  22. Console.Write(new string('*', stars));
  23. Console.Write(new string('-', dashes));
  24. Console.WriteLine();
  25. dashes--;
  26. stars += 2;
  27. }
  28.  
  29. for (int i = 0; i < n / 2; i++)
  30. {
  31. Console.Write('|');
  32. Console.Write(new string('*', n - 2));
  33. Console.Write('|');
  34. Console.WriteLine();
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement