Advertisement
plamen27

Diamond Fixed

Jun 28th, 2016
904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 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 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.  
  16.  
  17.  
  18. for (int i = 1; i <= (n - 1) / 2; i++)
  19. {
  20. Console.Write(new string('-', chertichki));
  21. Console.Write("*");
  22. var mid = n - 2 * chertichki - 2;
  23. if (mid >= 0)
  24. {
  25. Console.Write(new string('-', mid));
  26. Console.Write("*");
  27. }
  28. Console.WriteLine(new string('-', chertichki));
  29. chertichki--;
  30. }
  31. for (int i = n / 2; i < n; i++)
  32. {
  33.  
  34. Console.Write(new string('-', chertichki));
  35. Console.Write("*");
  36. var mid = n - 2 * chertichki - 2;
  37. if (mid >= 0)
  38. {
  39. Console.Write(new string('-', mid));
  40. Console.Write("*");
  41. }
  42. Console.WriteLine(new string('-', chertichki));
  43. chertichki++;
  44.  
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement