Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Task3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите количество строк матрицы A: ");
- int n = int.Parse(Console.ReadLine());
- Console.Write("Введите количество столбцов матрицы A: ");
- int m = int.Parse(Console.ReadLine());
- double[,] matrixA = new double[n, m];
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- {
- Console.Write($"Введите A[{i}][{j}]: ");
- matrixA[i, j] = double.Parse(Console.ReadLine());
- }
- Console.WriteLine("Введенная матрица: ");
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- Console.Write($"{matrixA[i, j]} ");
- if (matrixA[i, j] < 0)
- matrixA[i, j] *= matrixA[i, j];
- }
- Console.WriteLine();
- }
- Console.WriteLine("Преобразованная матрица: ");
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- Console.Write($"{matrixA[i, j]} ");
- Console.WriteLine();
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement