I would say 6 is in the 2
nd row and 3
rd column.
Try
#include <stdio.h>
#include <stdlib.h>
int main()
{
int nrows,ncols;
scanf("%d %d", &nrows, &ncols);
int matA[nrows][ncols];
int i,j;
for(i = 0; i < nrows; i++)
for(j = 0; j < ncols; j++)
scanf("%d",&matA[i][j]);
for(i = 0; i < nrows; i++)
{
for(j = 0; j < ncols; j++)
printf(" %d \t",matA[i][j]);
printf("\n");
}
printf("\n");
for(i = 0; i < nrows; i++)
for(j = 0; j < ncols; j++)
{
int nums = matA[i][j];
if(nums % (i+1) || nums % (j+1))
printf("Nema pogoden broj!\n");
else
printf(" %d\n", nums);
}
return 0;
}