The problem is that you initialize your array (a[]) to have the size of n before you'd assign any size to the variable n. If you do not assign any value to a variable, it will hold some random value (a.k.a. memory garbage). This is why your code does not work.
To make it work, declare your array after the user has provided the desired size for it.
Your code correctly:
#include <stdio.h>
int main()
{
int n;
printf("enter value of n \n");
scanf("%d",&n);
printf("enter array elements \n");
int a[n]; // Declare your array when the value of n is known.
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
for (int i = 0; i < n; i++)
{
if (a[i] % 2 == 0)
{
printf("even elements are %d \n", a[i]);
}
else
{
printf("odd elements are %d \n", a[i]);
}
}
return 0;
}