Advertisement
svetoslavhl

Fir_Tree

Mar 4th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 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.  
  9. int left = N-1;
  10. int right = N-1;
  11. int center = N-1;
  12.  
  13.  
  14. for (int f = 1; f <= N; f++) {
  15.  
  16.  
  17.  
  18. if (f == N) {
  19.  
  20. for(int g = 1 ; g <= (2*N - 3); g++){
  21.  
  22. if(g == center){
  23.  
  24. Console.Write("*");
  25.  
  26.  
  27.  
  28. }else{
  29.  
  30. Console.Write(".");
  31.  
  32.  
  33. }
  34.  
  35.  
  36.  
  37.  
  38. }
  39.  
  40.  
  41.  
  42.  
  43. }
  44. else{
  45.  
  46. for (int i = 1; i <= (2 * N - 3); i++) {
  47. if (i >= left && i <= right)
  48. {
  49.  
  50. Console.Write("*");
  51.  
  52.  
  53. }
  54.  
  55. else {
  56.  
  57. Console.Write(".");
  58.  
  59. }
  60.  
  61.  
  62.  
  63.  
  64. }
  65.  
  66. left--;
  67. right++;
  68. Console.WriteLine();
  69.  
  70. }
  71.  
  72.  
  73.  
  74.  
  75.  
  76. }
  77.  
  78. Console.WriteLine();
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement