#include #define ROWS 10 /* maximum number of rows */ #define COLS 10 /* maximum number of cols */ void read_2d (double a[][COLS], int r, int c); void add_2d (double a[][COLS], double b[][COLS], double s[][COLS], int r, int c); void print_2d(double a[][COLS], int r, int c); int main(void) { double x[ROWS][COLS], y[ROWS][COLS], z[ROWS][COLS]; int rows, cols; printf("Enter number of rows: "); scanf("%d", &rows); printf("Enter number of columns: "); scanf("%d", &cols); read_2d(x, rows, cols); /* read matrix x */ read_2d(y, rows, cols); /* read matrix y */ add_2d(x, y, z, rows, cols); /* Add x + y */ printf("The sum of two matrices is:\n"); print_2d(z, rows, cols); /* Print matrix z */ return 0; } /* A function to read a 2D array */ void read_2d (double a[][COLS], int r, int c) { int i, j; printf("Enter a table with %d rows\n", r); printf("Each row having %d numbers\n", c); for (i=0; i