Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.Write("n= ");
- int n = int.Parse(Console.ReadLine());
- int[,] a = new int[n,n];
- for (int row = 0; row < n; row++)
- {
- for (int col = 0; col < n; col++)
- {
- a[row, col] = int.Parse(Console.ReadLine());
- }
- }
- int[] c = new int[n * n];
- int k = 0;
- for (int row = 0; row < n; row++)
- {
- if(row%2==0)
- {
- for (int col = 0; col < n; col++)
- {
- c[k] = a[row, col];
- k++;
- }
- }
- else
- {
- for (int col = n-1; col >= 0; col--)
- {
- c[k] = a[row, col];
- k++;
- }
- }
- }
- Console.WriteLine("Елементите на c са: ");
- for (int i = 0; i < k; i++)
- {
- Console.Write(c[i] + " ");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement