Using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace ConsoleApplication26{ class Program { static void Main(string[] args) { Random r = new Random(); double[,] A = new double[3, 3]; Console.WriteLine("Исходная матрица: "); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { A[i, j] = r.Next(-100, 100); Console.Write(A[i, j] + " "); } Console.WriteLine(); } Console.WriteLine("Преобразованная матрица: "); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (A[i, j] % 3 != 0) { A[i, j] = 0; } } }
for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Console.Write(A[i, j] + " "); } Console.WriteLine(); }
} }}