 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can calculate some of the positive and negative elements present in 2D array. 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 TechMS which is available in Google Play. Now I am going to implement a code for you which will calculate some of the positive and negative elements available in 2D array. So first I am including a header file stdiv.h, then I am implementing main function. Inside main function, first I have to declare a 2D array. So its dimension is 3 by 3, then ij variables, then s1 which is 0, s2 which is also 0. Then I am printing a message, enter elements with the help of printf, this message will be displayed on console. Now to receive elements, I have to implement a for loop. Inside this for loop, I am implementing another for loop. So first loop is pointing to column sorry rows and second loop will be pointing to column elements. So with this nested loop combination, I am going to repeat the scan of statement which will read all the elements and all the elements will be stored at different indexes of a matrix. Now after completion of reading operation, I am implementing another loop. So this is first loop which will for rows. Inside this loop, I am implementing nested loop which is j and it will repeat for columns. Now inside this loop, I am implementing a if condition. If aij is greater than 0. So if array element which is available at aij position is greater than 0, then it is positive value. So I am adding that number into s1 using this statement s1 equals to s1 plus aij. If this condition is false, then I am implementing else if aij is less than 0. So if array element is less than 0, then I am going to add that element into s2 variable. So this is the statement s2 equals to s2 plus aij. So after completion of this nested loop combination, the result will be displayed on console with the help of this printf. So positive sum equals to percent d slash n negative sum equals to percent d then s1 comma s2. So this way I have implemented the complete program in front of you. So first segment of program is reading elements from user. Then second segment is calculating sum of positive and negative values. And after that at last sum is printed on console with the help of printf statement. Now I am going to execute this code. Sorry I forgot comma here. Again I am executing this code. You can see it is working now. So I am entering values 1, 2, 3, then minus 4, minus 5, minus 6, then 7, 8, 9. You can see the result. All positive numbers are added together and negative numbers are added together. So negative numbers are 4, 5, 6. So 6, 5, 11 plus 4, minus 15 and remaining numbers are equals to 30. So this way the program is working properly. It is calculating sum of positive and negative numbers separately. So I hope you have understood the concept well. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel that is youtube.com slash tanjaygupta underscore tech school. You can download my programming app Techimage which is available on Google Play. Thank you for watching this video.