# For diagonal difference this logic is showing a garbage value. Where am I doing wrong? [closed]

int main()
{
int i,a[3][3];
int diagonal_diff;

int lsum=0,rsum=0;
for(i=0;i<3;i++){
lsum=lsum+a[i][i];
rsum=rsum+a[i][2-i];
}
diagonal_diff= abs(lsum-rsum);
printf("%d",diagonal_diff);


}

• Hi, welcome to Data Science SE! Please improve your post by stating exactly what you get, why you think it's not what it should be, what you've tried and your question. Jan 12 '20 at 21:17