Learn How To Calculate Sum of Rows and Columns of Matrix (3 Dimensional) in C Programming Language. There are two codes here. The first program is to find the row sum of each row separately and the second code calculates the column sum of each column separately.

**Must Read: C Program To Find Sum of Matrix**

#### C Program To Find Sum of Rows of Matrix

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include<stdio.h> int main() { int array[10][10], row, column, i, j, sum = 0; printf("\nEnter The Limit of Rows:\t"); scanf("%d", &row); printf("\nEnter The Limit of Columns:\t"); scanf("%d", &column); printf("\nEnter Elements in the %d*%d Matrix\n", row, column); for(i = 0; i < row; i++) { for(j = 0; j < column; j++) { scanf("%d", &array[i][j]); } } printf("\nArray\n"); for(i = 0; i < row; i++) { for(j = 0; j < column; j++) { printf("%4d", array[i][j]); } printf("\n"); } for(i = 0; i < row; i++) { for(j = 0; j < column; j++) { sum = sum + array[i][j]; } printf("\nSum of Row No. [%d]:\t%d", i, sum); sum = 0; } printf("\n"); return 0; } |

**Must Read: C Program To Search Smallest Element in Matrix**

#### Output

**Must Read: C Program To Display Transpose of a Matrix**

#### C Program To Calculate Sum of Columns of Matrix

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include<stdio.h> int main() { int array[10][10], row, column, i, j, sum = 0; printf("\nEnter The Limit of Rows:\t"); scanf("%d", &row); printf("\nEnter The Limit of Columns:\t"); scanf("%d", &column); printf("\nEnter Elements in the %d*%d Matrix\n", row, column); for(i = 0; i < row; i++) { for(j = 0; j < column; j++) { scanf("%d", &array[i][j]); } } printf("\nArray\n"); for(i = 0; i < row; i++) { for(j = 0; j < column; j++) { printf("%4d", array[i][j]); } printf("\n"); } for(j = 0; j < column; j++) { for(i = 0; i < row; i++) { sum = sum + array[i][j]; } printf("\nSum of Column No. [%d]:\t%d", i, sum); sum = 0; } printf("\n"); return 0; } |

**Must Read: C Program To Find Sum of Lower Trianglular Elements**

#### Output

If you have any compilation error or doubts in this C Program To Calculate Sum of Rows and Columns of Matrix, let us know about it in the comment section below.