my problem is to add up the rows of a 2D array. im reading the values from a file using I/O redirection. <file3data.txt > out1.txt. My first function adds up the rows and it works fine but my second function is supposed to add up the product of the value and the position of the number in the array and i cant get it to work can someone please tell me what im doing wrong.

Code:#include<stdio.h> #include<stdlib.h> double calcSumAs(double x[], int row); double calcSumAXs(double x[], int row); int main(void) { int m; int n; int i; int j; double sumA; double sumAX; double a[100][100]; scanf("%d%d", &m, &n); for (i = 0; i < m; i++) { for (j = 0; j < n; j++) scanf("%lf", &a[i][j]); } for (i = 0; i < m; i++) sumA = calcSumAs(a[i], n); for (i = 0; i < m; i++); { sumAX = calcSumAXs(a[i], n); printf("\n%lf", sumAX); } return 0; } double calcSumAs(double x[], int row) { int i; double sumA = 0; for (i = 0; i < row; i++) sumA += x[i]; return sumA; } double calcSumAXs (double x[], int row) { int i; int j = 1; double sumAX = 0; for (i = 0; i < row; i++) { sumAX += x[i] * j; j++; } return sumAX; }