using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KekTus
{
class Program
static void PrintArr(int[][] arr)
foreach (var str in arr)
foreach (var el in str)
Console.Write($"{el}\t");
Console.WriteLine();
}
static void Main(string[] args)
int M;
int N;
try
Console.Write("M = "); M = int.Parse(Console.ReadLine());
Console.Write("N = "); N = int.Parse(Console.ReadLine());
catch
Console.WriteLine("Ошибка ввода");
return;
if (N < 0 || M < 0)
Console.WriteLine("Ошбка ввода");
Console.WriteLine("M = {0}; N = {1}.", M, N);
int[][] Arr = new int[M][];
var rand = new Random();
for(int i = 0; i < M; ++i)
Arr[i] = new int[N];
for (int j = 0; j < N; ++j)
Arr[i][j] = rand.Next(10,99);
Console.WriteLine("Исходный массив:");
PrintArr(Arr);
int[][] Buffer = new int[N][];
Buffer[j] = new int[M];
for (int i = 0; i < M; ++i)
Buffer[j][i] = Arr[i][j];
Arr = Buffer;
Console.WriteLine("Преобразованный:");
Console.WriteLine("Преобразованный :");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KekTus
{
class Program
{
static void PrintArr(int[][] arr)
{
foreach (var str in arr)
{
foreach (var el in str)
Console.Write($"{el}\t");
Console.WriteLine();
}
}
static void Main(string[] args)
{
int M;
int N;
try
{
Console.Write("M = "); M = int.Parse(Console.ReadLine());
Console.Write("N = "); N = int.Parse(Console.ReadLine());
}
catch
{
Console.WriteLine("Ошибка ввода");
return;
}
if (N < 0 || M < 0)
{
Console.WriteLine("Ошбка ввода");
return;
}
Console.WriteLine("M = {0}; N = {1}.", M, N);
int[][] Arr = new int[M][];
var rand = new Random();
for(int i = 0; i < M; ++i)
{
Arr[i] = new int[N];
for (int j = 0; j < N; ++j)
Arr[i][j] = rand.Next(10,99);
}
Console.WriteLine("Исходный массив:");
PrintArr(Arr);
Console.WriteLine();
int[][] Buffer = new int[N][];
for (int j = 0; j < N; ++j)
Buffer[j] = new int[M];
for (int i = 0; i < M; ++i)
for (int j = 0; j < N; ++j)
Buffer[j][i] = Arr[i][j];
Arr = Buffer;
Console.WriteLine("Преобразованный:");
PrintArr(Arr);
Console.WriteLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KekTus
{
class Program
{
static void PrintArr(int[][] arr)
{
foreach (var str in arr)
{
foreach (var el in str)
Console.Write($"{el}\t");
Console.WriteLine();
}
}
static void Main(string[] args)
{
int M;
int N;
try
{
Console.Write("M = "); M = int.Parse(Console.ReadLine());
Console.Write("N = "); N = int.Parse(Console.ReadLine());
}
catch
{
Console.WriteLine("Ошибка ввода");
return;
}
if (N < 0 || M < 0)
{
Console.WriteLine("Ошбка ввода");
return;
}
Console.WriteLine("M = {0}; N = {1}.", M, N);
int[][] Arr = new int[M][];
var rand = new Random();
for(int i = 0; i < M; ++i)
{
Arr[i] = new int[N];
for (int j = 0; j < N; ++j)
Arr[i][j] = rand.Next(10,99);
}
Console.WriteLine("Исходный массив:");
PrintArr(Arr);
Console.WriteLine();
int[][] Buffer = new int[N][];
for (int j = 0; j < N; ++j)
Buffer[j] = new int[M];
for (int i = 0; i < M; ++i)
for (int j = 0; j < N; ++j)
Buffer[j][i] = Arr[i][j];
Arr = Buffer;
Console.WriteLine("Преобразованный :");
PrintArr(Arr);
Console.WriteLine();
}
}
}