1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
public class Work18
{
public static void main(String[] args)
{
int[][] array={{99,22,639,15,66,19},{17,85,56,535,89,76},{56,67,71,51,24,873},{821,61,83,17,24,78},{2,232,87,95,68,49},{25,90,869,92,93,25}};
int[] sum=new int[6];
int max=0,max_value=0,i=0,j=0;
for(;i<array[0].length;i++)
for(;j<array[0].length;j++)
sum[i]=sum[i]+array[i][j];
for(i=0;i<array[0].length;i++)
{
if(sum[i]>max)
{
max_value=sum[i];
max=i;
}
if(sum[i]==max_value)
continue;
}
System.out.println("The max sum_value("+max_value+") is in the Line."+max);
}
}
|