199. C Program to Print Even position Elements in given array of elements.
How does this program work?
- This Program is used to Print Even position Elements in given array of elements.
Here is the code
#include <stdio.h>
int main(void)
{
int n,arr[10], i;
printf("\n Enter array size :");
scanf("%d",&n);
printf( "Enter array elements: ");
for(i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
}
printf("\nValues stored at even position are:\n");
for(i = 0; i < n; i++)
{
if(i%2 == 0)
printf("\na[%d] = %d\t ",i, arr[i]);
}
return 0;
}