-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiagonal-Difference
More file actions
58 lines (48 loc) · 1.24 KB
/
Copy pathDiagonal-Difference
File metadata and controls
58 lines (48 loc) · 1.24 KB
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
import java.util.*;
/**
*
* @author AbdAlwahab Hurbly
*/
public class Solution {
public static void main(String []args)
{
Scanner in = new Scanner (System.in);
int row =Integer.parseInt(in.nextLine());
int counter =0;
int res =0;
int res1 = 0;
int Final_res;
int rowC [][]= new int [row][row];
for(int i =0;i<row;i++){
for (int j=0;j<row;j++){
rowC[i][j]=in.nextInt();
}
}
for(int i =0;i<row;i++){
for (int j=0;j<row;j++){
}
}
for(int i =0;i<row;i++){
for (int j=0;j<row;j++){
res +=rowC[i][j];
i++;
}
do{
counter++;
}
while(counter!=row);
System.out.println(res);
}
for(int i =0;i<row;i++){
for (int j=row-1;j>=0;j--){
res1 +=rowC[i][j];
i++;
counter ++;
if(counter ==row-1)
break;
}
}
Final_res = Math.abs(res+res1);
System.out.println(Final_res);
}
}