View difference between Paste ID: N75tEr0C and FFKJvzEZ
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
7-
namespace Carpets
7+
class Carpets
8
{
9-
    class Program
9+
    static void Main()
10
    {
11-
        static void Main(string[] args)
11+
        int n = Int32.Parse(Console.ReadLine());
12
13-
            int n = int.Parse(Console.ReadLine());
13+
        for (int i = 1; i <= n / 2; i++) // i = rows
14-
            for (int i = 1; i <= n / 2; i++)
14+
15
            string filler = new string('.', n / 2 - i);
16-
                string filler = new string('.', n / 2 - i);
16+
            Console.Write(filler);
17-
                Console.Write(filler);
17+
18-
                for (int j = 1; j <= i; j++)
18+
            for (int j = 1; j <= i ; j++) // j = cols
19
            {
20-
                    if (j % 2 != 0)
20+
                if (j % 2 != 0) // if col % 2 != 0 , ако колоната е нечетна
21
                {
22
                    Console.Write("/");
23
                }
24
                else
25
                {
26
                    Console.Write(" ");
27
                }
28
            }
29-
                for (int j = 1; j <= i; j++)
29+
30
            for (int j = 1; j <= i; j++)
31-
                    if (i % 2 == 0)
31+
32
                if (i % 2 == 0) // if row % 2 == 0 , ако редът е четен ( 2,4,6...)
33-
                        if (j % 2 != 0)
33+
34-
                        {
34+
                    if (j % 2 != 0) // ако колоната е нечетна ( 1,3,5...)
35-
                            Console.Write(" ");
35+
36-
                        }
36+
37-
                        else
37+
38-
                        {
38+
39-
                            Console.Write("\\");
39+
40-
                        }
40+
41
                    }
42
                }
43
                else // ако редът е нечетен ( 1,3,5...)
44-
                        if (j % 2 != 0)
44+
45-
                        {
45+
                    if (j % 2 != 0) // ако колоната е нечетна ( 1,3,5...)
46-
                            Console.Write("\\");
46+
47-
                        }
47+
48-
                        else
48+
49-
                        {
49+
50-
                            Console.Write(" ");
50+
51-
                        }
51+
52
                    }
53
                }
54
            }
55-
                Console.Write(filler);
55+
56-
                Console.WriteLine();
56+
            Console.Write(filler);
57
            Console.WriteLine();
58-
            //second part
58+
59-
            int counter = 0;
59+
60-
            for (int i = n / 2; i >= 1; i--)
60+
        // second part
61
        int counter = 0;
62-
                string filler = new string('.', counter);
62+
63-
                Console.Write(filler);
63+
        for (int i = n / 2; i >= 1; i--) // i = rows
64-
                for (int j = 1; j <= i; j++)
64+
65
            string filler = new string('.', counter);
66-
                    if (j % 2 != 0)
66+
            Console.Write(filler);
67
68
            for (int j = 1; j <= i; j++) // j = cols
69
            {
70
                if (j % 2 != 0) // ако колоната е нечетна
71
                {
72
                    Console.Write("\\");
73
                }
74
                else
75-
                for (int j = 1; j <= i; j++)
75+
76
                    Console.Write(" ");
77-
                    if (i % 2 == 0)
77+
78
            }
79-
                        if (j % 2 != 0)
79+
80-
                        {
80+
            for (int j = 1; j <= i; j++)
81-
                            Console.Write(" ");
81+
82-
                        }
82+
                if (i % 2 == 0) // ако редът е четен
83-
                        else
83+
84-
                        {
84+
                    if (j % 2 != 0) // ако колоната е нечетна
85-
                            Console.Write("/");
85+
86-
                        }
86+
87
                    }
88
                    else
89
                    {
90-
                        if (j % 2 == 0)
90+
91-
                        {
91+
92-
                            Console.Write(" ");
92+
93-
                        }
93+
                else
94-
                        else
94+
95-
                        {
95+
                    if (j % 2 == 0) // ако колоната е четна
96-
                            Console.Write("/");
96+
97-
                        }
97+
98
                    }
99
                    else
100
                    {
101-
                Console.Write(filler);
101+
102-
                Console.WriteLine();
102+
103-
                counter++;
103+
104
            }
105
106
            Console.Write(filler);
107
            Console.WriteLine();
108
            counter++;
109
        }
110
    }
111
}