Guest User

Diamond

a guest
Jun 28th, 2016
219
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Diamond
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. var chertichki = (n - 1) / 2;
  15. for (int i = 1; i <= (n-1)/2; i++)
  16. {
  17. Console.Write(new string('-', chertichki));
  18. Console.Write("*");
  19. var mid = n - 2 * chertichki - 2;
  20. if (mid>=0)
  21. {
  22. Console.Write(new string('-',mid));
  23. Console.Write("*");
  24. }
  25. Console.WriteLine(new string('-', chertichki));
  26. chertichki--;
  27. }
  28. for (int i = 1; i <= (n - 2) / 2; i++)
  29. {
  30. chertichki++;
  31. Console.Write(new string('-', chertichki));
  32. Console.Write("*");
  33. var mid = n - 2 * chertichki - 2;
  34. if (mid >= 0)
  35. {
  36. Console.Write(new string('-', mid));
  37. Console.Write("*");
  38. }
  39. Console.WriteLine(new string('-', chertichki));
  40.  
  41. }
  42. }
  43. }
  44. }
RAW Paste Data