 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can find and replace a particular number in a matrix. Before starting, you can note my information, you can follow or subscribe my YouTube channel through the url youtube.com slash sanjaygupta underscore tax school. You can download my programming app, Techimps, which is available on Google Play. Now I am going to implement a code for you. So here, first a particular number will be searched in a matrix. If it is available, then a new number will be placed in place of that number. So I am implementing the code in C programming. Here I am declaring a 2D array i, j, then n1 and n2. After declaration of these variables, I am using printf, which will display the message enter elements on console. Now I am implementing for loop. This for loop will provide row indexes. Inside this for loop, I am implementing inner for loop, which will provide column indexes. Now I am implementing scanf, which will read the elements and all the elements will be stored inside a matrix or you can say a 2D array. Now again, I am implementing printf, which will display the message enter the number you want to find. To read that number, I am implementing scanf and I am reading that number in n1 variable. Now again, I am using printf. It will display the message enter new number. So the new number will be placed in place of the number, which we have searched. So in short, I can say n1 will be searched in a matrix. If it is available then in place of that number and 2 will be placed in matrix. So after reading three different inputs, first one is matrix, second one is n1, the number which we want to find and third one is n2, the new number which we want to place in matrix. After reading three inputs, I am applying the logical part. So here again, I am implementing master loops. So first I and then J. So I will be pointing row indexes and J will be pointing column indexes. So inside these loops, I am applying if condition. So you can see the if condition. Here I am comparing a of ij with n1. Sorry, I have to use double equals 2. So if a of ij is equals to n1, then I have to place n2 here. So the previous value of aij will be replaced with the value available inside n2 variable. So this way, wherever n1 is available in matrix, it will be replaced with the value available into n2 variable. So now after completion of this for loop, I can print the new matrix. So with the help of this printf, the new matrix message will be displayed on console to print new matrix. Again, I am using master loops. So inside this loop, I am going to print values of aij after completion of J loop. I am implementing slash n so that matrix can be printed row wise. And then at last it has zero. So it is the complete implementation of the code. So here you can see first I have read all the elements of matrix, then the number we want to find, then the number we want to place, and then I have applied the logic. And then at last the new matrix will be displayed on console. Now I am going to execute this code. You can see it is asking for elements. So I am entering one, two, three, then again one, two, three and again one, two, three. Now it is asking for the number which I want to find. So I am entering three. Then it is asking for the new number which I want to place in place of three. So I am entering five. You can see the new matrix one, two, five, one, two, five, one, two, five. So three is replaced with the value five. So this way I have applied the concept of find and replace on a matrix using 2D array. I hope you have understood the concept well how I have implemented the logic in C programming. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tax pool. You can download my programming app, Techimus, which is available on Google Play. Thank you for watching this video.