C Program to Find sum of each row in a Matrix

In this tutorial you will learn about the C Program to Find sum of each row in a Matrix and its application with practical example.

C Program to Find Sum of each row in a Matrix

In this tutorial, we will learn to create a C program that will Find the Sum of each row in a Matrix using C programming.

Prerequisites

Before starting with the tutorial, we assume that you are the best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in C programming.

Algorithm:-

Program to find the Sum of each row in a Matrix:-

In today’s tutorial, we will find the Sum of each row in a Matrix. First, we will take the size of the matrix from the user, and then we will take the input elements of the matrices. Now we will use the for loop to add the values of rows of that matrix. At last, we will print the result matrix row values after adding.

Program:-

 

Output:-

In the above program, we have first initialized the required variable.

  • a[10][10]= it will hold the integer value.
  • rw = it will hold the integer value for the loop.
  • cl = it will hold the integer value for the loop.
  • row = it will hold the input integer value for rows.
  • Column = it will hold the input integer value for columns.

Taking the size and the elements of the matrix from the user.

Adding the Sum of each row in the matrix using a for loop.

Printing the Sum of rows of the matrix.

In this tutorial we have learn about the C Program to Find sum of each row in a Matrix and its application with practical example. I hope you will like this tutorial.