Professional Documents
Culture Documents
Row Sum and Column Sum of A Matrix
Row Sum and Column Sum of A Matrix
Description:-
For loop-A for loop is a repetition control structure that allows you to efficiently
write a loop that needs to execute a specific number of times.
Syntax
The syntax of a for loop in C++ is −
for ( init; condition; increment ) {
statement(s);
}
Example:-
After providing the matrix value, the elements of the matrix should be
provided as shown below
The elements in the matrix are divided in row wise and column wise and
added i.e., the sum of row no 1 is calculated by adding all the elements
in row no 1 and similarly for row no2 and row no3.
For the sum of column no 1 is calculated by adding all the elements in
column no 1 and vice versa.