Advertisement
dbunalov

СТРЕЛКАТА КОЯТО ИМА И ДИАГОНАЛИ :)

Jul 28th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. using System;
  2. namespace xx.TESTER
  3. {
  4. class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. Console.Write("Enter odd numbers only [3..79]: ");
  9. int n = int.Parse(Console.ReadLine());
  10.  
  11. if (n % 2 == 0)
  12. {
  13. Console.WriteLine("Your number is not odd!");
  14. Console.Write("Enter odd numbers only [3..79]: ");
  15. n = int.Parse(Console.ReadLine());
  16. }
  17.  
  18. Console.WriteLine("{0}{1}{0}", new string('.', n / 2), new string('#', n));//first row
  19.  
  20. for (int i = 0; i < n - 2; i++)
  21. {
  22. Console.WriteLine("{0}#{1}#{0}", new string('.', n / 2), new string('.', n - 2));
  23. }
  24. Console.WriteLine("{0}{1}{0}", new string('#', n / 2 + 1), new string('.', n - 2));
  25. for (int i = 0; i < n - 2; i++)
  26. {
  27. Console.WriteLine("{0}#{1}#{0}", new string('.', i + 1), new string('.', (2 * n - 1) - 2 - 2 * i));
  28. }
  29. Console.WriteLine("{0}#{0}", new string('.', n - 1));
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement