-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindRow.cs
68 lines (62 loc) · 1.77 KB
/
FindRow.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1._2DArray
{
class FindRow
{
public void FindRowmatrix(int[,] a)
{
for (int i = 0; i < a.GetLength(0); i++)
{
int sum = 0;
for (int j = 0; j < a.GetLength(1); j++)
{
sum = sum + a[i, j];
Console.WriteLine(a[i, j] + " ");
}
Console.WriteLine("=" + sum);
Console.WriteLine();
}
}
public void FindColoummatrix(int[,] a)
{
for (int i = 0; i < a.GetLength(0); i++)
{
int sum = 0;
for (int j = 0; j < a.GetLength(1); j++)
{
sum = sum + a[i, j];
Console.WriteLine(a[i, j] + " ");
}
Console.WriteLine(" = " + sum);
Console.WriteLine();
}
}
public void FindMAxValue(int[,] a)
{
for (int i = 0; i < a.GetLength(1); i++)
{
int max = a[1, 0];
for (int j = 0; j < a.GetLength(0); j++)
{
if (a[j, i] > max)
{
max = a[i, j];
}
Console.WriteLine("max=" + max);
Console.WriteLine();
}
}
}
static void Main(string[] args)
{
int[,] a = { { 7, 14, 21 }, { 28, 35, 42 }, { 49, 56, 63 } };
FindRow fr = new FindRow();
fr.FindRowmatrix(a);
fr.FindMAxValue(a);
}
}
}