-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask9_6.java
More file actions
29 lines (25 loc) · 848 Bytes
/
Task9_6.java
File metadata and controls
29 lines (25 loc) · 848 Bytes
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
import java.util.ArrayList;
import java.util.List;
import static utils.Helper.*;
public class Task9_6 {
public static void main(String[] args) {
int[][] array = new int[Integer.parseInt(args[0])][Integer.parseInt(args[0])];
fillMatrix(array);
halfOfTheLineSum(array);
}
private static void halfOfTheLineSum(int array[][]) {
List<Double> result = new ArrayList<>();
for (int arr[] : array) {
double halfSum = 0;
for (int element : arr) {
if (element < 0)
element *= (-1);
halfSum += element;
}
halfSum = halfSum / arr.length;
result.add(halfSum);
}
System.out.println(lineSeparator() + "Result Matrix Rows 1 Col 5: ");
System.out.println((result));
}
}