 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can calculate some of even and odd values which are available in 1D array separately. Before starting, you can note my information. If you want to follow or subscribe my YouTube channel, you can use this URL that is youtube.com slash sanjaygupta underscore tech school. You can download my programming app that is TechMS which is available on Google Play. Now I am going to implement a code in C programming which will calculate some of even and odd values separately and these values are available in 1D array. So I am including a header file that is stdio.h then inside main function I am declaring an array in A of 10 i variable for loop counter S1 which is initialized with 0 and S2 which is also initialized with 0. S1 is containing some of even values and S2 will be containing some of odd values. Before addition, first I have to read array from user. So with this printf, the masses enter 10 elements will be displayed on console. For reading 10 elements, I am implementing a for loop. This for loop will repeat 10 times and it will repeat this scanf statement to receive 10 numbers and all the numbers will be stored inside array at different indexes. After completion of reading process, I am implementing another loop which will also repeat 10 times because array is containing 10 elements. If size is greater than this value, you can modify the rotation of loop according to that size. Now in second loop, I am implementing a if condition which is checking value of ai. If it is completely divisible by 2, it means the number is even. So S1 equals to S1 plus a of i. So with this way even numbers will be added inside S1 variable. If this if condition is false then it means a of i is containing odd value. So inside else section a of i will be added into S2. So this way inside for loop, if condition is deciding that whether a of i will be added inside S1 or it will be added into S2. After completion of this loop, all the even numbers will be added inside S1 and all the odd numbers will be added inside S2. So now I just have to print the result on console with the help of this printf. So I am writing even equals to %d, S1 and second printf is for printing odd numbers and it is printing value of S2. I have used slash n for newline character. So this way S1 and S2 will be displayed on console. So this is the complete code which will calculate some of even and odd values which are available in 1D array. So now I am executing this code. I am entering 10 elements 1, 2, 1, 2, 1, 2, 1, 2. You can see 5 times 1 and 5 times 2 are available. So even sum is 10 and odd sum is 5. So odd ones are 5, so 5 and even 2 is again available 5 times, so 5 into 2, 10. So this way it is working properly and correct results are displayed on console. So this way I have calculated some of even and odd values separately which are available in 1D array. Now if you want to reduce number of loops, so you can remove this loop and you can enclose these statements inside the loop which is reading the elements from the user. So scanf will read a number and immediately it will be tagged whether it is even or odd. So if number is even then it will be added into S1 otherwise it will be added into S2. This way you can calculate some of even and odd values through a single loop. Now again I am executing this code. I am entering same numbers. You can see the result. Same result is displayed again. So this is optional whether you are implementing reading and calculation part in a single loop or you are implementing them separately with the help of two separate loops. One for reading and one for calculation. So both ways are correct. You can choose any one of them as per your requirement. So I hope you have understood how you can calculate some of even and odd values which are available in 1D array with the help of C program. If you want to watch more programming related videos you can follow my YouTube channel through the URL that is youtube.com slash sanjay gupta underscore tech fool. You can download my programming app that is TechMS which is available on Google Play. So keep connected with me. Follow my YouTube channel. Watch programming related videos because programming is very easy. It only requires practice. If you do regular practice then programming is just a fun. Thank you for watching this video.