 Hello friends, I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you how you can implement matrix, addition, subtraction and transport methods with the help of C language. If you want to watch their algorithmic implementation, so those playlist links are available in the description of this video, so you can follow that. Now, first I'm going to implement addition method. So void addition, then I need to pass values here. So this is first parameter in A, size will be 3 things. So in case of 2D array, whenever we pass arguments, so we need to pass their rows and column size as well. So this is B and third one is C. Now inside this block, I am going to write the definition of addition. So I'm going to declare 2 variables. Then column. So this is outer loop inside this loop. I'm going to implement one more loop. And here I'm going to add values and they will be storing into C matrix. So I'm going to add aij location with bij. So this way this is the first definition, which is adding values of A and B matrix and those values will be assigned into C matrix. And whatever modification will be done into C matrix that will be automatically available from where we are going to call this addition method. So now I'm going to copy this and I'm pasting this. I'm changing its name to subtraction. Our parameters will be same. Loops will be same. And here I'm putting minus instead of plus. So this is the second method that is subtraction. Now I'm going to implement third method, which is for transpose. So void transpose. Here I'm going to pass only one matrix because I'm going to print transpose of one matrix. So again, I'm going to declare 2 variables. So whenever we are going to print transpose of a matrix, so rows will be printed into columns and columns will be printed as rows. So here I'm implementing 2 loops. First is for i. Second is for j. And inside this loop I'm going to print values of this A matrix. So let's say I'm putting for sending the backslash team and here I'm putting Aji. So whenever you want to print transpose of any matrix, so you need to swap the indexes. So in normal case we use aij, but in this case we are going to use aji. And after this inner loop completion we can print backslash in so that output will be printed in form of matrix. So this way I implemented all three methods. Now you might be thinking like I'm writing the solution on the, you also want to learn how this logic will be working. So you can watch my lecture video for that purpose. So you will be finding a link to playlist that is mentioned as DSA using C. So if you go to that playlist, so I have explained the logic of this programmatic implementation with the help of board. So there you can understand the internal logic how it will be executed. Here I am just implementing the methods so that you can learn how we can process these operations like addition, subtraction and transpose with the help of main methods. So this is a complete program that you can use while completing your assignments. So in main function I'm going to create three matrix and the two variables ij. Now I'm going to print a message and first matrix. Now here I'm going to implement two loops. So this national formation will be reading values of first matrix from the user right now we can copy this and we can use it for second matrix input. So just change this first to second and a to b. So this way, both a and b matrix values will be provided by the user and these statements will be those values. Now we need to call the methods that we have implemented before. So first I'm going to call addition methods. So I'm calling addition passing ABC as an argument. So a and b having values and C is blank. So this addition function responsibilities to receive all three matrix as a parameter and to fill the addition of the matrix into C. And the addition of C matrix will be available into game function automatically. So now here I can print. So I can use printf some of two matrix and here I'm using this again. So instead of scanf I'm going to use printf or send the backslash team. And here I'm using C of IJ when this loop will complete. So for new line, we can write printf backslash and right. So this way, addition will be printed. Now I'm just copying this pasting this here I'm calling subtraction putting subtraction of two matrix and the result will be available into C only. And for printing transpose, I just need to call transpose and I'm passing a matrix as an argument. So this way I called all three methods that we implemented above main function. So now this program is completed ready to execute. So I'm saving this. So before execution, we need to check whether any compilation error is available here or not. So I'm going to compile and run. So it is compiled successfully. So let me share my full screen so that you can see that as well. So I'm just stopping the share. I'm going to share my full screen. Yeah. So now you will be able to that output screen as well. So, so here you can see it is asking for first matrix values. So let's say I'm entering four. So nine times I entered four and nine times I'm entering two. So two is for second matrix. Right. So first matrix will be printing some sorry first output will be some second output will be subtraction and third will be transpose. So here you can see some is six subtraction is two and third is printing transpose. So I just forward to use the label so that we can identify. We are going to print transpose. So here I'm writing transpose. Right. Again, I'm executing this. Sorry, I missed semi column. So again, I'm executing this. So you will see this time. So I'm entering this time these values one, two, three, four, five, six, seven, eight, nine. Also, you can enter values like this. Right. So here you can see though I entered same value of both the matrix or some is printed, but subtraction is zero and transpose is also printed correctly because I entered one, two, three, four, five, six. And again, a second row and seven, eight, nine and third row, but you can see they are printed in follow. Right. So this way I hope you understood how we can implement the complete program to implement addition, subtraction and transpose off to the area. So again, if you want to watch their algorithmic implementation or you want to understand how the politics are working. So you can just go to description of this video. And there you will find the playlist links. One is for algorithm. Second is for DSA using C classroom teaching. And third is implementation of all DSA problems with the Alcove C language. So follow those pages so that you can learn data structure in proper way. I hope you understood whatever I demonstrated in this video. Thank you for watching this video. Thank you for watching this video.