Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Carpets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int width = int.Parse(Console.ReadLine());
- int center=width/2;
- // Upper Right Side
- for (int row = 1; row <=center; row++)
- {
- for (int col = 1; col <=center; col++)
- {
- if (col <= center - row)
- {
- Console.Write('.');
- }
- else
- {
- if (center % 2 == 0)
- {
- if (((row % 2 != 0) && (col % 2 == 0)) || ((row % 2 == 0) && (col % 2 != 0)))
- {
- Console.Write('/');
- }
- else if (((row % 2 == 0) && (col % 2 == 0)) || ((row % 2 != 0) && (col % 2 != 0)))
- {
- Console.Write(' ');
- }
- }
- else
- {
- if( (row%2!=0 && col%2!=0) || (row%2==0 && col%2==0))
- {
- Console.Write('/');
- }
- else if( (row%2==0 && col%2!=0) || (row%2!=0 && col%2==0 ))
- {
- Console.Write(' ');
- }
- }
- }
- }
- //Upper Left Side
- for (int col = center; col>=1; col--)
- {
- if (col <= center - row)
- {
- Console.Write('.');
- }
- else
- {
- if (center % 2 == 0)
- {
- if (((row % 2 != 0) && (col % 2 == 0)) || ((row % 2 == 0) && (col % 2 != 0)))
- {
- Console.Write('\\');
- }
- else if (((row % 2 == 0) && (col % 2 == 0)) || ((row % 2 != 0) && (col % 2 != 0)))
- {
- Console.Write(' ');
- }
- }
- else
- {
- if ((row % 2 != 0 && col % 2 != 0) || (row % 2 == 0 && col % 2 == 0))
- {
- Console.Write('\\');
- }
- else if ((row % 2 == 0 && col % 2 != 0) || (row % 2 != 0 && col % 2 == 0))
- {
- Console.Write(' ');
- }
- }
- }
- }
- Console.WriteLine();
- }
- //Down Right Side
- for (int row = center; row >0; row--)
- {
- for (int col = 1; col <= center; col++)
- {
- if (col <= center - row)
- {
- Console.Write('.');
- }
- else
- {
- if (center % 2 == 0)
- {
- if (((row % 2 != 0) && (col % 2 == 0)) || ((row % 2 == 0) && (col % 2 != 0)))
- {
- Console.Write('\\');
- }
- else if (((row % 2 == 0) && (col % 2 == 0)) || ((row % 2 != 0) && (col % 2 != 0)))
- {
- Console.Write(' ');
- }
- }
- else
- {
- if ((row % 2 != 0 && col % 2 != 0) || (row % 2 == 0 && col % 2 == 0))
- {
- Console.Write('\\');
- }
- else if ((row % 2 == 0 && col % 2 != 0) || (row % 2 != 0 && col % 2 == 0))
- {
- Console.Write(' ');
- }
- }
- }
- }
- //Down Left Side
- for (int col = center; col >= 1; col--)
- {
- if (col <= center - row)
- {
- Console.Write('.');
- }
- else
- {
- if (center % 2 == 0)
- {
- if (((row % 2 != 0) && (col % 2 == 0)) || ((row % 2 == 0) && (col % 2 != 0)))
- {
- Console.Write('/');
- }
- else if (((row % 2 == 0) && (col % 2 == 0)) || ((row % 2 != 0) && (col % 2 != 0)))
- {
- Console.Write(' ');
- }
- }
- else
- {
- if ((row % 2 != 0 && col % 2 != 0) || (row % 2 == 0 && col % 2 == 0))
- {
- Console.Write('/');
- }
- else if ((row % 2 == 0 && col % 2 != 0) || (row % 2 != 0 && col % 2 == 0))
- {
- Console.Write(' ');
- }
- }
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment