Advertisement
AmidamaruZXC

Untitled

Oct 13th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task3
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.Write("Введите количество строк матрицы A: ");
  10.             int n = int.Parse(Console.ReadLine());
  11.             Console.Write("Введите количество столбцов матрицы A: ");
  12.             int m = int.Parse(Console.ReadLine());
  13.             double[,] matrixA = new double[n, m];
  14.             for (int i = 0; i < n; i++)
  15.                 for (int j = 0; j < m; j++)
  16.                 {
  17.                     Console.Write($"Введите A[{i}][{j}]: ");
  18.                     matrixA[i, j] = double.Parse(Console.ReadLine());
  19.                 }
  20.             Console.WriteLine("Введенная матрица: ");
  21.             for (int i = 0; i < n; i++)
  22.             {
  23.                 for (int j = 0; j < m; j++)
  24.                 {
  25.                     Console.Write($"{matrixA[i, j]} ");
  26.                     if (matrixA[i, j] < 0)
  27.                         matrixA[i, j] *= matrixA[i, j];
  28.                 }
  29.                 Console.WriteLine();
  30.             }
  31.  
  32.             Console.WriteLine("Преобразованная матрица: ");
  33.             for (int i = 0; i < n; i++)
  34.             {
  35.                 for (int j = 0; j < m; j++)
  36.                     Console.Write($"{matrixA[i, j]} ");
  37.                 Console.WriteLine();
  38.             }
  39.  
  40.             Console.ReadKey();
  41.         }
  42.     }
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement