Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace ExamTasks
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] matrix = new int[7, 7];
- int i = 0;
- int j = 0;
- int counter = 1;
- while (counter < 49)
- {
- while (j < 7)
- {
- if (matrix[i, j] != 0)
- break;
- else
- {
- matrix[i, j] = counter;
- counter++;
- j++;
- }
- }
- j--;
- i++;
- while (i < 7)
- {
- if (matrix[i, j] != 0)
- break;
- else
- {
- matrix[i, j] = counter;
- counter++;
- i++;
- }
- }
- i--;
- j--;
- while (j >= 0)
- {
- if (matrix[i, j] != 0)
- break;
- else
- {
- matrix[i, j] = counter;
- counter++;
- j--;
- }
- }
- i--;
- j++;
- while (i >= 0)
- {
- if (matrix[i, j] != 0)
- break;
- else
- {
- matrix[i, j] = counter;
- counter++;
- i--;
- }
- }
- i++;
- j++;
- }
- matrix[i, j] = 49;
- counter = 0;
- int[] b = new int[49];
- int k = 1;
- i = 0;
- j = 0;
- while (counter < 48)
- {
- while (j < 8 - k)
- {
- b[counter] = matrix[i, j];
- counter++;
- j++;
- }
- j--;
- i++;
- while (i < 7 - k)
- {
- b[counter] = matrix[i, j];
- counter++;
- i++;
- }
- while (j >= k - 1)
- {
- b[counter] = matrix[i, j];
- counter++;
- j--;
- }
- i--;
- j++;
- while (i >= k)
- {
- b[counter] = matrix[i, j];
- counter++;
- i--;
- }
- i++;
- j++;
- k++;
- }
- b[counter++] = matrix[i, j];
- for (int f = 0; f < 49; f++)
- Console.Write(b[f] + "\t");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement