 and welcome to the video lecture on matrix operations. At the end of this video lecture, students will be able to write a C program for matrix operations addition using 2D array. The following topics will be discussed in this video lecture. Matrix addition using 2D array, demonstration of a simple program of matrix addition. Matrix addition. The rule for matrix addition is that both matrix should have the same order. Here same order means similar number of rows and columns of both matrices. During addition operation of two matrix the corresponding cells of both matrix that aij and bij will be added as shown here where i and j are variables for row and column index. As shown in this example if a is a matrix in which elements are 1 1 1 1 and b is 2 3 4 5 the addition will be the sum of the two matrix will be 3 4 5 6. The addition matrix addition the addition of corresponding cell elements from both a and b matrix is done. In this process the first row first column element of a that is a of 0 0 is added with first row first column element of b that is b of 0 0 and stored in first row first column element of c of 0 0. Similarly the first true second column element of a that is a of 0 1 is added with first true second column element of b that is b of 0 1 and stored in first true second column element of c of 0 1. Similarly the second row first column element of a that is a of 1 0 is added with second row first column element of b that is b of 1 0 and stored in first row first column element of c 1 0. Lastly the second row second column element of a that is a of 1 1 is added with second row second column element of b that is b of 1 1 and stored in the second row second column element of c 1 1. The for loop causes the process of adding two matrices having the similar row index and column index. The row index is denoted by i of 0 1 and column index by g of 0 1. In this way addition is done for a of 0 0 plus b of 0 0 a of 0 1 plus b of 0 1 a of 1 0 plus b of 1 0 a of 1 1 plus b of 1 1. The process is repeated until index that is row index and column index both become equal to 1. Now pause this video for a few seconds and try to write answer to the question. Fill in the blanks for m and n values for addition of a 3 cross 3 matrix. For i equal to 0 i is less than m i plus plus in the bracket again for j equal to 0 j is less than n j plus plus in the bracket c of i j is equal to a of i j plus b of i j. The close the bracket. Now for estimating or the addition of 3 cross 3 matrix in the last lecture we had discussed how we had done the declaration and initialization of an array. So in that the starting index or the base index was starting from 0 and ends with the last index that is array size minus 1. So here array size is 3 cross 3 it means 3 minus 1 2 but it's saying i is less than it should be i equal to 2 so it will be i less than 3. So this loop will go on calculating the addition of matrices up to i equal to 0 1 2. So this will be the answer for the m and n values will be 3 and 3. Now in this that is the in this slide we will be demonstrating a simple program for addition of a 2 cross 2 matrix, addition of a 2 cross 2 matrix. So we'll be dealing with this using a code blocks software. So it will mainly start with the two header files that is hash include stdio.h hash include conio.h then I'll say with the int main the main function then I'll say I'll declare two matrix int a capital A to maximum sizes 2 then comma b 2 2 comma c is my output matrix c 2 2 declaration of a a b and c matrix then I'll say int i comma j it's i for row and j for column then I say for i equal to 0 i is less than that is what is the main maximum value is 2. So it will be i plus plus in the bracket for j equal to 0 j is less than 2 j plus plus bracket. I'll say printf enter the elements of matrix a I'll end with a semicolon scanf percentage d comma and a of ij it will be capital as c is the case sensitive capital a of ij ending with a semicolon the same thing I'll be writing for b matrix for i equal to 0 i is less than 2 i plus plus bracket for j equal to 0 j is less than 2 j plus plus bracket I'll say printf enter the elements of b matrix scanf percentage d again format specify for integer data type and b of ij ending with a semicolon now I'll say printf I'll simply just say that added matrix is slash n for i equal to 0 i is less than 2 i plus plus bracket for j equal to 0 j is less than 2 j plus plus bracket then I'll say c of ij that is our my output matrix will be c of ij equal to a of ij plus b of ij enter then I'll print this value whatever the matrix it will be getting stored in the c matrix so it will be again printf percentage d comma c of ij then I'll be to end with a semicolon as I want it to be with the space so I'll be saying printf slash t then I'll say printf slash n then I'll say return 0 after successful execution then I'll be correcting this I'll go for build I'll go for compile I'll go for run I'll be adding the same value 1 1 1 then 2 3 4 5 so added matrix is 3 4 5 6 on successful execution so these are the following references let us see why eson p connector thank you