Advertisement
baobaobao

PERFECT DIAMOND2

Aug 24th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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 PerfectDiamond
  8. {
  9. class PerfectDiamond
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. var spaces2 = n - 2 ;
  15.  
  16.  
  17. //UPPER
  18. Console.WriteLine("{0}*", new string (' ', n -1));
  19. for (int row = 1; row <= n - 1; row++)
  20. {
  21.  
  22. Console.Write("{0}*", new string (' ', spaces2));
  23. for (int col = 0; col < row; col++)
  24. {
  25. Console.Write("-*");
  26.  
  27. }
  28. spaces2--;
  29. Console.WriteLine();
  30. }
  31.  
  32.  
  33.  
  34. //LOWER
  35. spaces2 = 1;
  36. for (int row = 1; row <= n - 2; row++)
  37. {
  38.  
  39. Console.Write("{0}*", new string(' ', spaces2));
  40. for (int col = n-2; col >= row; col--)
  41. {
  42. Console.Write("-*");
  43.  
  44. }
  45. spaces2++;
  46. Console.WriteLine();
  47. }
  48. Console.WriteLine("{0}*", new string(' ', n - 1));
  49.  
  50.  
  51.  
  52.  
  53.  
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement