using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[,] matrix = new int[7, 5];
string input;
string [] str;
Console.WriteLine("Исходная матрица:\n");
for (int i = 0; i < 7; ++i)
{
input = Console.ReadLine();
str = input.Split(' ');
for (int j = 0; j < 5; ++j)
matrix[i, j] = int.Parse(str[j]);
}
int max = -1;
int indMax = 0;
for (int i = 0; i < 7; ++i)
{
max = -1;
for (int j = 0; j < 5; ++j)
{
if (matrix[i, j] > max)
{
max = matrix[i, j];
indMax = j;
}
}
matrix[i, indMax] = matrix[i, indMax] * (indMax + 1);
}
Console.WriteLine("Конечная матрица:\n");
for (int i = 0; i < 7; ++i)
{
for (int j = 0; j < 5; ++j)
{
Console.Write("{0:d} ", matrix[i, j]);
}
Console.WriteLine();
}
}
}
}