 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can count how many even and odd elements are available in a matrix by passing 2D array into function. 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 Techimus which is available on Google Play. Now I am going to implement the program in C programming which can demonstrate you how you can count even and odd elements available in a matrix and I will be passing the 2D array into function. So first I am including a header file that is STDIO.h then I am declaring a function whose name is count and it will receive an argument that is a 2D array of integer type. So this statement is function declaration and the return type of count function is void. Now I am implementing definition of main. Inside main I am declaring a 2D array then IJ variables. Now to read elements of matrix first I have to display the message on console. So with the help of printf I will be displaying enter elements message on console. To read the elements I am applying nested loops. So here you can see I have implemented two loops. One is I and second one is J. So I will be providing row indexes and J will be providing column indexes. Then with the help of scanf all the elements will be stored inside a matrix at different indexes and indexes are provided with the help of I and J variables. So this is the complete process of reading elements from 2D array. Now I have to call count function where I can pass this 2D array. So this statement is function calling and then return 0. So this way you can see I have implemented the definition of main which is reading 2D array and then calling count function and passing K 2D array as an argument. Now after implementation of main I am defining count function. So this block will be known as function definition. Inside this block I am declaring some variables. So you can see I have initialized C1 and C2 with 0. So C1 will be counting quantities of even values and C2 will be counting quantities of odd values. For logic I am again implementing nested loops. So here you can see I have implemented I and J loops. So I will be providing row indexes and J will be providing column indexes. Now for logic I am applying F condition which will check whether the element is divisible by 2 or not. So now you can see this F condition which is A of IJ modulus 2. So if A matrix IJ position is divisible by 2 then that number is even. So I can write C1 plus plus else I can write C2 plus plus. So now you can see this logic. If this F condition which is available at line number 23 is true then C1 counter will be incremented by 1. Otherwise C2 counter will be incremented by 1. So C1 is counting even values and C2 is counting odd values. So after completion of these loops I can print the counted values on console. So even quantity equals to %d slash an odd quantity equals to %d then C1 comma C2. So this way I have implemented the complete code in front of you which is counting the quantities of even and odd values available in a matrix. Now I am executing this code. So I am entering values. So you can see even equals to 4 and odd equals to 5. So 2, 4, 6, 8, only 4 even values are available and 1, 3, 5, 7, 9, 5 odd values are available in this matrix. So you can see the program is working properly. It is showing the correct results on console. So I hope you have understood how we can pass 2D array into function and how we can count how many even and odd values are present in a 2D matrix. So if you want to watch more programming related videos you can follow or subscribe my YouTube channel through the URL youtube.com. You can download my programming app Techimage which is available on Google Play. Thank you for watching this video.