 Hello friends, I am Sanjay Gupta. I welcome you to Sanjay Gupta Tech School. In this video, I am going to explain how you can implement an algorithm related to matrix addition, subtraction, and passports using C language. So first I am going to take in our matrix addition. So let's implement the function. So the more function is matrix addition, it will be requiring some parameters. So let's say the first parameter is force matrix whose dimension is 833. Then the second parameter is second matrix whose dimension is also 333. Then third parameter, third matrix, which is also had a size as 333, then 8C1, 8R2, and 8C2. So R1 and C1 is for rows and columns of force matrix, R2 and C2 is for rows and columns for sitting matrix. Now inside this, we can implement two variables as ij. Then we need to apply this condition. So we need to check whether R1 is equal to R2 or C1 is equal to R2. If anyone is unequal, then we can stop this matter. And here I am writing R1 is not equal to R2 or C1 is not equal to C2. So if anyone of us is true, then we can write a printf addition not possible and return. So return will stop the execution of this matter if this condition is true. If this condition is false, then we can apply the addition operation. So for that we can implement R2. So it will be for rows. So you can use R1 or R2 because if both are equal, then only we will be having execution of these statements. So you can use R1 or R2 or both will be correct. Then second rule that you need to repeat until C1 or C2 whichever you want to write. And inside this you can write C of ij equals to a of ij plus b of ij. So this way A matrix index values will be added with B matrix index values and there some will be added with C matrix. And then you can close these values and close the main function. And you can put the return type of this function as void because we are not going to return any value. And the sum will be added with C matrix. So let's suppose you are calling this method from main function. So in main function you need to read A and B values from user. And after reading those values from the sum will be performed with this method. And this method will be updating the value of C matrix. So here you can see we have not written the value of values of C matrix. But after calling this method, after calling this method in main function and it's a completion with the return type of C matrix. So after calling this method you can just print the value of C matrix. So that will be the sum of two minutes. So this way I explain you how we can write function to add to matrix in C. Then you can just convert this function into subtraction as well. So from here you can add and put the subtract. The rest of the things will be same. Here also we need to write subtraction and instead of plus you can use minus. So this is the method that will be performing subtraction operation. So subtraction logic is similar to addition just you need to place the plus and minus. Now after explaining addition and subtraction, now we need to understand how we can write the code for transpose. So I am erasing these. So in case of transpose we just require only one matrix as input and then we can print the transpose of the matrix. So I hope you know the logic of transpose we need to print rows in column or you can say columns into rows. So now I am going to write that. So why transpose here I'm writing it a three by three. Then we can also receive those are column values. So that we can create a loop. So here I'm writing two variables. I am there for a critical I'm going to use R and C values. So here I'm writing I equals to zero I as R I plus plus then for J equals to zero J less than C and J less. So first loop will be repeating R and second loop will be repeating C times. Now inside the second loop I can write critical percent B and A of J. So normally whenever we want to print a matrix we use A and J. But if you want to print a transpose then in that case you need to use A and J. Then you can close this loop. Then you can write printed translation and then you can close this. So let's say if we have a matrix of three by three size and we have these values. And these are the indexes. Now I is starting from zero. Then J is also starting from zero. So first time zero zero index value will be printed. Now J will be included on you. So J is one. So J is one and I is zero. So again we need to print a J. So J is one and I is zero. So first time one was printed. Now this four will be printed after this one. Again J will be included. So J is two this time. So we need to print two zero index. So that is seven. So here you can see all the values are printed in terms of rows. So that is transpose. You need to print all the columns in form of rows so your matrix will convert into transpose. Or you can say your matrix is printed in form of transpose. So this way I hope you understood how we can write a function in C so that we can implement transpose algorithm. Or you can say we can implement the algorithm that we have to transpose in C language. So you can call this function into main. Main will be passing to the array to a column size and this code will be written transpose of that matrix. So I hope this way you understood how we can implement algorithm related to additional subtraction in transpose in C language. So you can implement three different functions. First is for addition, second for subtraction and third for transpose. And you can call all those three functions into main so that individual outputs will be printed out output. So this way I completed my explanation related to these topics in this video. If you want to watch more algorithm or their implementation you can see related video. So you can go to description of this video and you will find links of playlist. You can follow those playlist so that you can understand how we can write algorithms and how we can implement those algorithms in C language. Thank you for watching this video.