AlexJC

Perfect Diamond

Aug 27th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 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 Perfect_Diamond
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = int.Parse(Console.ReadLine());
  14.  
  15. for (int row = 0; row < n; row++)
  16. {
  17. for (int col = 1; col < n - row; col++)
  18. {
  19. Console.Write(" ");
  20. }
  21. Console.Write("*");
  22.  
  23. for (int startCol = 0; startCol < row; startCol++)
  24. {
  25. Console.Write("-*");
  26. }
  27. Console.WriteLine();
  28. }
  29.  
  30. for (int row = n - 2; row >= 0; row--)
  31. {
  32. for (int col = 1; col < n - row; col++)
  33. {
  34. Console.Write(" ");
  35. }
  36. Console.Write("*");
  37.  
  38. for (int startCol = 0; startCol < row; startCol++)
  39. {
  40. Console.Write("-*");
  41. }
  42. Console.WriteLine();
  43. }
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment