Advertisement
xandria1

Untitled

Aug 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System; romb ot zvezdi
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. int numberSpaces = n-1;
  9.  
  10.  
  11. //gorna chast
  12.  
  13. for (int row = 1; row <= n; row++)
  14. {
  15. Console.Write(new string(' ', numberSpaces));
  16. Console.Write('*');
  17.  
  18. if(row>1)
  19. {
  20. for (int col = 1; col < row; col++)
  21. {
  22. Console.Write(" *");
  23. }
  24.  
  25. }
  26. numberSpaces-=1;
  27. Console.WriteLine();
  28. }
  29.  
  30. //dolna chast
  31. int numSpaces = 1;
  32. for (int row = n - 1; row >= 1; row--)
  33. {
  34. Console.Write(new string(' ',numSpaces));
  35. Console.Write('*');
  36. int number = n-2;
  37.  
  38. for(int col = 1; col < row; col++)
  39. {
  40. Console.Write(" *");
  41. }
  42.  
  43.  
  44. numSpaces++;
  45. Console.WriteLine();
  46. }
  47.  
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement