I need to check if sums of i-th row and j-th column are same in 2d array and output i of the row and j of the column and sum. Also how can I make count it normally like [1][1],[1][2]
etc.
Thanks in advance.
That's what I've got and sadly it's not working
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int sum1 = 0, sum2 = 0;
int a[2][3];
int i, j;
for (i = 0; i<2; i++)
{
for (j = 0; j<3; j++)
{
printf("a[%d][%d] = ", i, j);
scanf("%d", &a[i][j]);
}
}
for (i = 0; i<2; i++)
{
sum1 = 0, sum2 = 0;
for (j = 0; j<3; j++)
{
sum1 += a[i][j];
sum2 += a[j][i];
}
if (sum1 == sum2)
printf("row is %d and column is %d = %d", i, j, sum1);
}
return 0;
}