#include
int main(int argc, char const *argv[])
{
int a[6][5];
int temp, kz = 0;
int sum[6]; //存放各行元素和
/*输入数据*/
for (int i = 0; i < 6; i++)
for (int j = 0; j < 5; j++)
scanf("%d", &a[i][j]);
/*计算各行之和*/
for (int i = 0; i < 6; i++)
{
sum[i] = a[i][0];
for (int j = 1; j < 5; j++)
sum[i] += a[i][j];
}
//找出各行和最小的行
temp = sum[0];
for (int i = 1; i < 6; i++)
if (temp > sum[i])
{
temp = sum[i];
kz = i;
}
//输出各行之和,和最小行的行数
for (int i = 0; i < 6; i++)
printf("%d\n", sum[i]);
printf("最小行的行为第%d行,其值为%d", kz + 1,temp);
return 0;
}
public class test {
public static void main(String[] args) {
int[][] arr={{1,2,3,4},{5,6,7,8},{9,10,11,12,13}};
int[] a=new int[3];
for(int i=0;i
for(int j=0;j
}
System.out.println("第"+(i+1)+"行的和:"+sum);
a[i]=sum;
}
int min=a[0];
for(int i=0;i
min=a[i+1];
}
System.out.println("最小行的和:"+min);
}
}