Advertisement
svetoslavhl

Sand_Glass

Mar 4th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. int N = int.Parse(Console.ReadLine());
  8. int left = 0;
  9. int right = N+1;
  10.  
  11. for (int f = 1; f <= N; f++) {
  12.  
  13. if(f < N/2 + 1){
  14.  
  15. for (int a = 1; a <= N; a++) {
  16.  
  17.  
  18. if (a <= left || a >= right) {
  19.  
  20. Console.Write(".");
  21.  
  22. }
  23.  
  24. else {
  25.  
  26. Console.Write("*");
  27.  
  28. }
  29.  
  30. }
  31. left++;
  32. right--;
  33. Console.WriteLine();
  34.  
  35. }else{
  36.  
  37. for (int b = 1; b <= N; b++) {
  38.  
  39.  
  40. if (b <= left || b >= right) {
  41.  
  42. Console.Write(".");
  43.  
  44. }
  45.  
  46. else {
  47.  
  48. Console.Write("*");
  49.  
  50. }
  51.  
  52. }
  53.  
  54.  
  55.  
  56.  
  57. left--;
  58. right++;
  59. Console.WriteLine();
  60.  
  61.  
  62. }
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement