hello i got problem with this, its really simple but i dunno wheres my mistake or maybe i am copying the matrixs in wrong way

i need to find the biggest element and sum up other elements in his horizontal line minus the biggest one. All this need to be copyed in new matrix with same elements but in the spot where the biggest one was i need to put the sum mentioned befor.

Code:

#include<stdio.h>
int main()
{
int a[100][100],b[100][100],i,j,m,n,max,z=0,x=0,y=0;
printf(".........\n");
scanf("%d",&m);
scanf("%d",&n);
printf("..........\n");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{
printf("a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
max=a[0][0];
for(i=0;i<m;i++)
for(j=0;j<n;j++)
if(a[i][j]>max)
{
max=a[i][j];
x=i;
y=j;
}
for(i=x;i=x;i=x)
for(j=0;j<n;j++)
z+=a[i][j];
z-=max;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
b[i][j]=a[i][j];
b[x][y]=z;
for(i=0;i<m;i++)
{ for(j=0;j<n;j++)
printf("%d",b[i][j]);
printf("\n");
}
return 0;
}