Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class SunGlasses
- {
- static void Main()
- {
- int N = 5;
- char[,] matrix = new char[N, N];
- int leftSlash = 0, rightSlash = N - 1;
- for (int row = 0; row < matrix.GetLength(0); row++)
- {
- for (int col = 0; col < matrix.GetLength(1); col++)
- {
- if (leftSlash == col && row != N / 2)
- {
- matrix[row, col] = '\\';
- }
- else if (row == N / 2)
- {
- if (col < N / 2)
- {
- matrix[row,col] = '-';
- }
- else if (col > N / 2)
- {
- matrix[row, col] = '-';
- }
- else
- {
- matrix[row, col] = '*';
- }
- }
- else if (rightSlash == col && row != N / 2)
- {
- matrix[row,col] = '/';
- }
- else if (col == N / 2 && row != N / 2)
- {
- matrix[row, col] = '|';
- }
- else//точките
- {
- matrix[row, col] = '.';
- }
- }
- rightSlash--;
- leftSlash++;
- }
- for (int row = 0; row < matrix.GetLength(0); row++)
- {
- for (int col = 0; col < matrix.GetLength(1); col++)
- {
- Console.Write(matrix[row,col]);
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement