Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class TStripedTowel
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- char stripe = '#';
- char space = '.';
- for (int i = 1; i < n; i += 2)
- {
- int check = n;
- int checkTwo = n;
- int checkThree = n;
- for (int j = 1; j <= n; )
- {
- Console.Write(new string(stripe, 1));
- --check;
- ++j;
- if (check >= 2)
- {
- Console.Write(new string(space, 2));
- check -= 2;
- j += 2;
- }
- else if (check == 1)
- {
- Console.Write(new string(space, 1));
- check -= 1;
- j += 1;
- }
- else
- {
- continue;
- }
- }
- Console.WriteLine();
- for (int m = 1; m <= n; )
- {
- if (checkTwo >= 2)
- {
- Console.Write(new string(space, 2));
- checkTwo -= 2;
- m += 2;
- }
- else if (checkTwo == 1)
- {
- Console.Write(new string(space, 1));
- checkTwo -= 1;
- m += 1;
- }
- if (checkTwo >= 1)
- {
- Console.Write(new string(stripe, 1));
- --checkTwo;
- ++m;
- }
- }
- Console.WriteLine();
- for (int l = 1; l <= n; )
- {
- if (checkThree == n)
- {
- Console.Write(new string(space, 1));
- checkThree -= 1;
- l += 1;
- }
- Console.Write(new string(stripe, 1));
- --checkThree;
- ++l;
- if (checkThree >= 2)
- {
- Console.Write(new string(space, 2));
- checkThree -= 2;
- l += 2;
- }
- else if (checkThree == 1)
- {
- Console.Write(new string(space, 1));
- checkThree -= 1;
- l += 1;
- }
- else
- {
- continue;
- }
- }
- Console.WriteLine();
- }
- int checkFour = n;
- for (int p = 1; p <= n; )
- {
- Console.Write(new string(stripe, 1));
- --checkFour;
- ++p;
- if (checkFour >= 2)
- {
- Console.Write(new string(space, 2));
- checkFour -= 2;
- p += 2;
- }
- else if (checkFour == 1)
- {
- Console.Write(new string(space, 1));
- checkFour -= 1;
- p += 1;
- }
- else
- {
- continue;
- }
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement