 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can find out those numbers which are prime 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 tech school. You can download my programming app Techimage which is available on Google Play. Now I am going to implement a code in C programming so that you can understand how we can solve this problem. So I am including a header file stdio.h. Then inside main function, I am going to declare a 2D array of dimension 3 by 3. Then two variables i, j, then variable n and f. Now with the help of printf, I am going to show the message enter elements. To receive or read the elements, I am applying for loop i which will provide row indexes. Then another loop which will provide column indexes. Inside these loops, I am applying scanf statement. So this scanf will read the elements and all these elements will be stored inside a matrix. Now I have to apply another logic so that I can find whether the element which is available in a matrix is prime or not. So if it is prime, then I have to display that number on console, otherwise I have to ignore that number. So the list of numbers which are prime only will be printed on console. So here I am applying this loop. Here I am implementing master loops. So I will be providing row indexes and j will be providing column indexes. Now inside this loop, I am using n equals to aij. So this way I have assigned value of aij index into n. Now I am assigning 0 into f. Inside this I am going to implement third loop k equals to 2k less than n and k plus plus. So this loop will be checking whether n is divisible by k or not. So here I have to declare k variable. Now I am applying if condition if n modulus k w equals to 0. So if this condition is true, then I am assigning 1 into f and I am using break. So this way with this loop I am checking prime number. So if n is divisible by k, then only f will become 1 and loop will be terminated, otherwise value of f will remain 0. So after completion of k loop, I have to check value of f. So if f is 0, then only number is prime. So I can print percent d is prime number and I can display the value of n. So this way I have implemented the complete code which is checking a of ij whether it is prime or not. So if it is prime, then it will be displayed on console with the help of n, otherwise not. Then at last I can apply return 0. So this is the complete program. Now I can execute it. So I am entering 11, 12, 13, 14, 15, 16, 17, 18, 19. You can see the list 11 is prime, 13 is prime, 17 is prime and 19 is prime. 12 is not prime because it is divisible by 2, 14 is not prime because it is divisible by 7, 15 which is divisible by 5, 16 divisible by 2, 18 divisible by 2. So the program is working properly, it is printing only those numbers which are prime. So this way you can find out the numbers which are prime and available in a matrix. So I hope you have understood how we can find out all those numbers which are prime and available in matrix. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjay gupta underscore tax school. You can download my programming app Techimage that is available on Google Play. Thank you for watching this video.