 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can calculate some of the elements available at even index in 1D array. Before starting, you can note my information, you can watch and subscribe my YouTube channel through this URL that is youtube.com slash sanjaygupta underscore tech school. You can download my programming app TechMS that is available on Google Play. Now, I am going to implement a code for you which will calculate some of the elements that are available at even index in 1D array. First of all, I am including a header file that is stdio.h then main function. Inside main, I am first declaring an array, its size is 10, then i variable it will be used for loop control and then s which is initialized with 0. It will be containing some. Then I am using printf statement. This printf will display enter 10 elements message on console. To receive these 10 numbers, I am implementing a for loop. For loop is started from zero condition is i less than 10 and increment part is i plus plus. So this loop will repeat 10 times with this loop. I am implementing scanf statement which will receive 10 integers inside array a at different indexes which will be provided with the variable i. So this scanf statement is reading a particular element and that element will be stored at a of i position. So a is name of array and i is representing index. So i is started from zero and it will end to nine. So from zero to nine total 10 indexes will be filled through this scanf statement. Now I have to add those elements which are available at even index. So again I am implementing for loop. This time I am applying if condition. Condition is i modulus to double equals to zero. So i is representing index. So if index is divisible by two, it means index is representing even index. So s equals to s plus a of i. So this way the elements which are available at even indexes will be added inside as after completion of for loop. I can print some on console using this printf statement. So this is complete implementation of the program. Now I am going to execute this code. You can see it is asking for ten elements. So I am entering one ten times. So it should be printing five. You can see it is printing five because from index zero to four six and eight all indexes are containing one. So some is five. Now if I want to remove this if condition, it is also possible. Now I am removing this if condition and I am modifying this increment part i equals to i plus two. So this way index will be incremented by two every time. So initially it is zero. So zero index will be added with s variable. Then i will become two. So by incrementing i with two, it will be providing only even indexes values and that will be added inside s. Now again I am executing this code. I am entering ten times one. You can see the output. It is again printing sum equals to five. Now what if I want to remove this for loop, second for loop and I just want to calculate some of elements which are available at even index through single loop. So I am removing this for loop. Now I am using this loop which is reading elements from the user and inside this loop I am applying if condition. So now you can see this for loop. It is reading an element. Now if is checking the index, if index i is divisible by two, then only A05 will be added to s and this process will repeat until this condition is false. So this way all the elements will be stored inside array and those elements which are available at even indexes will be added to s. After completion of this loop, s will be printing the sum on console. So now again I am executing this code. This time I am entering numbers like this 1, 2, 1, 2. So you can see at even indexes I have entered only one and at odd indexes I have entered two. So this time also it is showing sum equals to five. So this way I have demonstrated you three different ways to calculate some of the elements which are available at even indexes. Now if you want to calculate some of the elements which are available at odd indexes, you can just convert this condition i modulus to not equals to zero. So if index is not divisible by two, then it will be representing odd index. So this program will print some of elements which are available at odd indexes. So I hope you have understood all the possibilities which I have demonstrated to you. 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 tax school. You can also download my programming app that is Takamis which is available on Google Play. So if you want to learn programming, you can connect with me. Programming is fun. If you do practice regularly, you can easily understand all the concepts which are available in programming languages. Thank you for watching this video. Keep connected with me. Thank you.