请教一个关于计算并输出二维数组每一行和的问题
#include<stdio.h>
void main()
{ int mx[5][5]={0};
int x,y,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0;
while (x=1)
{
for (y=0;y<5;y++)
sum1+=mx[x][y];
printf("the sum of the first row is %d\n",sum1);
break;
}
while (x=2)
{
for (y=0;y<5;y++)
sum2+=mx[x][y];
printf("the sum of the second row is %d\n",sum2);
break;
}
while (x=3)
{
for (y=0;y<5;y++)
sum3+=mx[x][y];
printf("the sum of the third row is %d\n",sum3);
break;
}
while (x=4)
{
for (y=0;y<5;y++)
sum4+=mx[x][y];
printf("the sum of the fourth row is %d\n",sum4);
break;
}
while (x=5)
{
for (y=0;y<5;y++)
sum5+=mx[x][y];
printf("the sum of the fifth row is %d\n",sum5);
break;
}
}
为什么第五行的和总是显示不对呢?